None assigment

Mark Pilgrim f8dy at my-deja.com
Thu Feb 8 13:16:59 EST 2001


In article <95ugd4$jka$1 at panix6.panix.com>,
  aahz at panix.com (Aahz Maruch) wrote:
> In article <mailman.981633367.1329.python-list at python.org>,
> Gregoire Welraeds  <greg at perceval.be> wrote:
> >
> >While playing a bit with python 2.0, I found that I can assign some
value
> >to None
> >
> >EG: None= 2
> >
> >which I found to be very pernicious because then the following, for
> >example, won't work any more:
> >
> >>>> b= filter(None, [1,2,'',3])
> >
> >Bug or feature ?
>
> Neither, really; it's Just The Way Things Work.

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're smart; why haven't you learned Python yet?
http://diveintopython.org/


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list