[Python-Dev] PEP 326 now online

Gerrit Holl gerrit at nl.linux.org
Sun Jan 4 14:44:03 EST 2004


[I already sent this in private mail before this message arose here]

PEP 326 reads:
> Users of Python have had the constant None, which represents a lack of
> value, for quite some time (possibly from the beginning, this is
> unknown to the author at the current time).  The author believes that
> ``All`` should be introduced in order to represent a functionally
> infinite value, with similar behavior corresponding to None.

I think the described behavious of None is one of the rarest uses of
None. Actually, I didn't even know of the existence of this behaviour.
I think None is mainly used to show the absence of *anything*: when a
function does not return a value, it return None, when some variable
does not have a value yet, it may be set to None, when a HTTP connection
is not opened yet, it's socket is None, etc.

> Introducing an ``All`` built-in that works as described does not take
> much effort.  A sample Python implementation is included.

I don't think it is used very often. ``All`` is not a very
straightforward name as well. The implementation is created very
quickly: it can be done even simpler than you did, although it won't be
repr'ed All then:

class Infinity(object):
    def __cmp__(self, other):
        return 1

This is usable everywhere you describe. Because ``All`` is not a very
straightforward name, I think the namespace cluttering is worse than the
advantages. To convince me, I think you'll need to come up with a better
name. It isn't ``All`` really, because that makes sense only with
container types, it isn't ``Infinity`` because that makes sense only
with numbers (strings?), so this is the biggest problem of your
proposal.

just my 0.02 nanoEUR,
yours,
Gerrit.

-- 
41. If any one fence in the field, garden, and house of a chieftain,
man, or one subject to quit-rent, furnishing the palings therefor; if the
chieftain, man, or one subject to quit-rent return to field, garden, and
house, the palings which were given to him become his property.
          -- 1780 BC, Hammurabi, Code of Law
-- 
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/



More information about the Python-Dev mailing list