None assigment

amused at amused at
Thu Feb 8 14:26:25 EST 2001

In article <95unqf$4j3$1 at>,
  Mark Pilgrim <f8dy at> wrote:
> Indeed.  I once had a similar experience; while playing around in the
> Python IDE, I defined a variable 'dir' to hold some directory path.
> Then days later (having never shut down Python), I wondered why the
> built-in 'dir' function didn't work.
> Which leads to the following questions:
> - Are there any true constants in Python?  (I don't think so, but
> correct me if I'm wrong.)
> - Once you've redefined a built-in function like 'dir', is there any
> way to get it back without restarting Python?
> -M
> --

You can delete it from the local namespace with del:

Python 2.1a1 (#9, Jan 22 2001, 20:58:30) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> dir
<built-in function dir>
>>> dir = "Spam"
>>> dir
>>> del dir
>>> dir
<built-in function dir>


Sent via

More information about the Python-list mailing list