> You can say "x = 1 if expr else 2", but you cannot say "x = 1 if expr". You do a two line
This one liner works:
if expr: x = 1
> Or how about mutable default values in function paramters? That makes a lot of sense...This can be helpful under certain circumstances (e.g. memoization) [1]. The linked article also points out that it can be useful for rebinding global names in optimized code.
[0] https://stackoverflow.com/a/1145781
[1] https://web.archive.org/web/20200221224620id_/http://effbot....