New submission from SukkoPera <[EMAIL PROTECTED]>:
I have just encountered a Python behaviour I wouldn't expect. Take
the following code:
------------------------------------------------------------------------
class Parent:
a = 1
def m (self, param = a):
print "param = %d" % param
class Child (Parent):
a = 2
p = Parent ()
p.m ()
c = Child ()
c.m ()
------------------------------------------------------------------------
I would expect to receive the following output:
param = 1
param = 2
But actually I get:
param = 1
param = 1
Is this the correct behaviour, and then why, or is it a bug? For
reference, I am using Python 2.5.1 on GNU/Linux.
There has been a short discussion about this at
http://groups.google.it/group/comp.lang.python/browse_thread/thread/9f740eea131e7ef2/56fd4e120a069a1d#56fd4e120a069a1d.
----------
components: None
messages: 69943
nosy: SukkoPera
severity: normal
status: open
title: Unexpected default arguments behaviour
type: behavior
versions: Python 2.5
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3403>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com