[Python-Dev] nodef
Raymond Hettinger
python at rcn.com
Thu May 24 06:47:46 CEST 2007
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
More information about the Python-Dev
mailing list