DEV Community

Discussion on: What do you dislike about your favorite language?

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

Python's "ternary" operator

foo = bar if baz else baz

Not sure why, though.

Collapse
 
thefluxapex profile image
Ian Pride • Edited

I agree, I'd much prefer AutoHotkey's (or similar): ?:
<TEST>?<IF>:<ELSE>

foo := baz?bar:baz
; Or
foo := (baz?bar:baz)
; Or
foo := (a=b)?a:b
; Or 
foo := ((a=b)?a:b)
Collapse
 
rhymes profile image
rhymes

Yeah, that's not great.

I often use dicts for dispatching, instead of using if/elif/else