Storing empties

Alex Martelli aleax at mail.comcast.net
Wed Nov 2 04:17:35 CET 2005


Aahz <aahz at pythoncraft.com> wrote:
   ...
> >>>the canonical idiom when you need such distinction is:
> >>>
> >>>_not_there = object()
   ...
> >> What's your preferred idiom when you're dealing with storable objects?
> >
> >What's a "storable object"?  You mean, something that can be pickled, or
> >passed to the .write method of a file object, or stored in a database,
> >or what else?
> 
> Pickled and/or stored in a DB.

Relational databases have the concept of NULL specifically to indicate
"there is NOTHING here".  I love it.

For pickling, object() as a unique "nothing here, NOT EVEN a None"
marker (AKA sentinel) works fine.


Alex



More information about the Python-list mailing list