static variables?

Erik Max Francis max at alcyone.com
Thu Nov 21 18:23:03 EST 2002


Chad Netzer wrote:

> 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).


Well, there are certainly other behaviors that have been changed when it 
was realized that they presented problems (such as the rather 
controversial upcoming change of integer division).  In other words, I 
don't really see any evidence that the current behavior was a conscious 
decision made anywhere beyond the point of, "This is the easiest way to 
do it."

> 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).


True it would involve more overhead, but if you have to create new 
objects manually anyway, you obviously have to incur the same overhead, 
so this doesn't really seem to be a real objection.

-- 
  Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
  __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ I always entertain great hopes.
\__/ Robert Frost
     Blackgirl International / http://www.blackgirl.org/
  The Internet resource for black women.




More information about the Python-list mailing list