4 ms·
Sorry for the bikeshedding, but double negatives are a real pain. Not so much for the code itself, but for talking to colleagues and giving talks. Off the top o
by timClicks 14y ago
Sorry for the bikeshedding, but double negatives are a real pain. Not so much for the code itself, but for talking to colleagues and giving talks. Off the top of my head, Empty would could work.
- aroberge 14y agoPersonally I would use "assigned" 1) to better reflect the meaning and 2) to follow PEP-8 and not use an uppercase.
- shmeedogg 14y agoUppercase was chosen to match Python's existing singletons, `True`, `False`, and `None`. Lowercase might look a little too much like a variable, and all-upper might look too much like a module-level const, IMHO.
- shmeedogg 14y agoAgreed. 'Empty' works, as does 'Blank' or 'Unassigned'.'Nil' is concise, but might be a little too easily confused with 'None' (especially so for someone coming from Ruby). I'd love an approach that used the standard library, but there doesn't seem to be a type-agnostic approach. float('nan') won't make sense for other types, and using `types.NoneType` instead of `None` seems even less understandable.
- mst 14y agoI think I'd've gone for Unset. Empty's a bit close to None.
- aiiane 14y agoHow about 'Omitted'? foo=Omitted if foo is not Omitted:
- shmeedogg 14y agoTo my ear, this does sound the best. Thanks for the suggestion!