staticmethod behaviour

Samu samufuentes at gmail.com
Wed Aug 25 09:03:51 EDT 2010


Hi,

I run today into some problems with my code and I realized that there
is something in the behaviours of the @staticmethod that I don't
really understand. I don't know if it is an error or not, actually,
only that it was, definitely, unexpected.

I wrote a small demo of what happens.

The code:
http://dpaste.com/hold/233795/

The answer I get:
User created with static: id, rights, rights2
1 ['read', 'write'] ['write2'] ['write3']
User created with User()
None [] ['write2'] ['write3']

I was expecting either all arrays from the second to be [] or to be a
copy of the first one.

If someone can provide an explanation, I would be thankful :)

Regards,
Samu



More information about the Python-list mailing list