3 ms·
> 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 n
by knodi123 5y 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'
- cle 5y agoI've always assumed this was to maintain syntactic consistency with comprehensions like [x for x in arr if x > 2].