static variables?

Chad Netzer cnetzer at mail.arc.nasa.gov
Thu Nov 21 17:55:10 EST 2002


On Thursday 21 November 2002 13:51, Erik Max Francis wrote:

> I was simply pointing that it was not beyond the realm of possibility to
> have it behave as most newbies expect.  The reason it's done the way it
> is is because it's the simplest implementation; there really aren't any
> higher, more laudable goals involved.

Actually, I think you are wrong.  It is done the way it is done for 
consistency.  It may also have been the easiest to implement (simply because 
it *IS* the most consistent and inconsistencies naturally lead to more code), 
but I doubt it would have been THAT much harder to implement invariant 
default arguments, if it had been considered important.  I think it just 
wasn't recognized as a significant problem (and indeed, it is a debatable 
one).

However, I do agree that, on the whole, the current behavior probably strikes 
most users as surprising at first, even when it is understood to be the 
expected behavior.  Most people would probably want their default arguments 
to be invariant from call to call (which would entail more overhead, I hasten 
to add, since objects might have to be created for each call).

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list