[Python-Dev] nodef (original) (raw)
Raymond Hettinger python at rcn.com
Thu May 24 06:47:46 CEST 2007
- Previous message: [Python-Dev] nodef
- Next message: [Python-Dev] Wither PEP 335 (Overloadable Boolean Operators)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: "Greg Ewing"
If the aforementioned iterable can yield anything, then it might yield this 'nodef' value as well.
For this reason, there can't exist any standard guaranteed-unambiguous sentinel value. Each use case needs its own, to ensure it's truly unambiguous in the context of that use case.
Right.
That's why Barry and others write:
missing = object() v = d.get(k, missing)
That is the guaranteed way to get a unique object.
Raymond
- Previous message: [Python-Dev] nodef
- Next message: [Python-Dev] Wither PEP 335 (Overloadable Boolean Operators)?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]