Unexpected behavior when initializing class

alfred.fazio at gmail.com alfred.fazio at gmail.com
Wed Nov 28 03:37:07 EST 2007


On Nov 28, 3:31 am, Paul Rudin <paul.nos... at rudin.co.uk> wrote:
> You have to understand that the default value for v - an empty list -
> is made at compile time - and it's the *same* list every time it's
> used i.e. if you don't pass in a value for v when you make new
> instances of your class.

*smack*!!  That's me smacking myself on the forehead.  I now remember
reading a long time ago that this was an FAQ!  Thanks for the reply,
Paul.  :)

Alfred J. Fazio,
alfred.fazio at gmail.com



More information about the Python-list mailing list