Deprecating reload() ???

Jeff Epler jepler at
Mon Mar 15 18:33:04 CET 2004

On Mon, 15 Mar 2004 05:49:58 -0600, Skip Montanaro <skip at>
> >You'd have to disable the integer free list.  There's also code in
> >tupleobject.c to recognize and share the empty tuple.  String interning
> >could be disabled as well.  Everybody's ignored the gorilla in the room:
> >
> >    >>> sys.getrefcount(None)
> >    1559

On Mon, Mar 15, 2004 at 10:15:33AM -0700, David MacQuigg wrote:
> Implementation detail.  ( half wink )

I'd round that down from half to None, personally.

This is guaranteed to work:
    x = None
    y = None
    assert x is y
by the following text in the language manual:
            This type has a single value. There is a single object with
            this value. This object is accessed through the built-in
            name None.  It is used to signify the absence of a value in
            many situations, e.g., it is returned from functions that
            don't explicitly return anything. Its truth value is false.
There are reams of code that rely on the object identity of None, so a
special debug mode where "x = <some literal>" makes x refer to something
that has a refcount of 1 will break code.

The 'is' guarantee applies to at least these built-in values:
    None Ellipsis NotImplemented True False

The only problem I can see with reload() is that it doesn't do what you
want.  But on the other hand, what reload() does is perfectly well
defined, and at least the avenues I've seen explored for "enhancing" it
look, well, like train wreck.


More information about the Python-list mailing list