[Python-3000] Special object to return from functions that return only None
Aahz
aahz at pythoncraft.com
Tue Apr 25 18:35:21 CEST 2006
On Tue, Apr 25, 2006, Kevin Jacobs <jacobs at bioinformed.com> wrote:
>
> Actually this sounds a lot like a signaling Not-a-number (sNaN)
> from IEEE754. One can pass around a sNaN, but any use will raise a
> (numeric) exception. Similarly, you want a signaling Not-an-Object
> (sNaO) that also doesn't like to be passed as a function argument. It
> is the last bit that makes it a pain, since what if your function is
> log_error_value(sNaO)?
Note that Python does make it fairly straightforward to define such
objects on a per-domain basis. E.g.:
sentinel = object()
The biggest problem from my POV with widespread adoption of this
technique is that it doesn't play well with pickle. Perhaps someone
wants to take a whack at defining a more generic mechanism for sentinels?
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"Argue for your limitations, and sure enough they're yours." --Richard Bach
More information about the Python-3000
mailing list