Hacker News new | ask | show | jobs
by knodi123 1623 days ago
> still seems inconsistent to me (putting the function before the array)

I'm experienced in ruby, and learning python for a project. I don't think I'll ever not wince when using python's ternary;

ruby: size = (waist > 30) ? 'large' : 'small'

python: size = 'large' if (waist > 30) else 'small'

1 comments

I've always assumed this was to maintain syntactic consistency with comprehensions like [x for x in arr if x > 2].