Is 'everything' a refrence or isn't it?
fredrik at pythonware.com
Sun Jan 15 21:48:39 CET 2006
Donn Cave wrote:
> | > What's the value of None? Would you say "it has no value" or "it's value
> | > is None" or something else?
> | it has no value (or if you prefer, the set of values is empty).
> Dang, I would have said it does have a value.
> For one thing, in
> if a:
> print 'more or less True'
> print 'evidently not'
> None doesn't follow the default, so it seems like "if" has discovered
> some sort of value in there.
the "if" statement happens to use object identity to determine truth values
for certain special objects, including None:
if (v == Py_True)
if (v == Py_False)
if (v == Py_None)
/... query object .../
in the more general case, it's up to the object's type implementation to deter-
mine its "truth value", in response to a __nonzero__ or __len__ query.
maybe we need a new word for "virtual values" that are not really part of an
object's internal state ?
More information about the Python-list