
Martin Blais wrote:
I don't know what lives in the iterable, so why should I make assumptions?
I think Python needs a builtin for this very purpose. I propose 'nodef', a unique object whose sole purpose is to serve as a default value.
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. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing@canterbury.ac.nz +--------------------------------------+