Author tomcl
Recipients tomcl
Date 2009-08-03.21:25:49
SpamBayes Score 4.90163e-13
Marked as misclassified No
Message-id <>
The enclosed script when run under 2.6.2 IDLE standard distribution on
x86 shows that shallow copy (.copy()) of a non-empty defaultdict object
returns an empty defaultdict!

Other ways to copy, e.g. defaultdict(none, d.items()), work fine.

Bug appears under:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on win32

I have tested it on two different computers. They both also have the
visual installed from a v2.6 binary - but I can't see why this would
change standard libraries.

Hope I am not being stupid - this seems to big a bug to be real!

**Documentation on defaultdict states (nearly all) methods are same as
dict, and on dict defines copy() as returning a shallow copy.

**replace defaultdict by dict and this example works as expected

Best wishes, Tom

PS - I am new to python so forgive any stupidity!
Date User Action Args
2009-08-03 21:25:53tomclsetrecipients: + tomcl
2009-08-03 21:25:52tomclsetmessageid: <>
2009-08-03 21:25:50tomcllinkissue6637 messages
2009-08-03 21:25:49tomclcreate