Bugs item #1427789, was opened at 2006-02-08 13:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1427789&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason (griminventions)
Assigned to: Nobody/Anonymous (nobody)
Summary: List not initialized if used as default argument
Initial Comment:
class A( object ):
def __init__( self, someList = [] ):
self.someList = someList
if __name__ == "__main__":
for i in range( 10 ):
a = A()
a.someList.append( "abc" )
print a.someList
Instead of each instance of A getting an empty list, it
is somehow the same list as the previous instance of A.
It will not occur with the following change:
class A( object ):
def __init__( self ):
self.someList = []
I'm using Windows XP, Python 2.4.1.
[EMAIL PROTECTED]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1427789&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com