loading...

re: What do you dislike about your favorite language? VIEW POST

FULL DISCUSSION
 

Python's "ternary" operator

foo = bar if baz else baz

Not sure why, though.

 

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)
 

Yeah, that's not great.

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

code of conduct - report abuse