[ python-Bugs-1652387 ] Nested Objects scope problem

SourceForge.net noreply at sourceforge.net
Mon Feb 5 14:35:21 CET 2007


Bugs item #1652387, was opened at 2007-02-05 13:35
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=1652387&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: Build
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: kkelchev (kkelchev)
Assigned to: Nobody/Anonymous (nobody)
Summary: Nested Objects scope problem

Initial Comment:
K = MyObj()
K.Lines.append('First line to Obj "K"')
K.Lines.append('Second line to Obj "K"')
L = MyObj()
L.Lines.append('First line to Obj "L"')
print 'Lines from Obj "K"',K.Lines
print 'Lines from Obj "L"',L.Lines


Result is:
[Dbg]>>> 
Lines from Obj "K" ['First line to Obj "K"', 'Second line to Obj "K"', 'First line to Obj "L"']
Lines from Obj "L" ['First line to Obj "K"', 'Second line to Obj "K"', 'First line to Obj "L"']
>>> 

Why data appended into nested list filed “Lines”  into different object “K” and “L”  appears in both objects ?



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1652387&group_id=5470


More information about the Python-bugs-list mailing list