Re:PEP 505: Bringing None-Aware Operators to Python
by agumonkey on Sunday August 12, 2018 @07:50AM
(#17743963)
do people use
or is it considered non idiomatic in python ?
[ Parent
| on HN ]
Re:PEP 505: Bringing None-Aware Operators to Python
by tomchristie on Sunday August 12, 2018 @08:00AM
(#17743986)
It’s okay-ish. You do need to be careful about what falsey values `x` might be tho, as it could introduce edge-case bugs.
Using `x = [] if x is None else x` is more precise.