Andrew Dalke added the comment:

I was optimization tuning and wondered why UserDict was imported by os.  
Replacing 
UserDict with dict passes all existing regression tests.

I see the concerns that doing that replacement is not future proof.  Strange 
then 
that Cookie.py is acceptable.  There are three places in Lib which derive from 
dict, 
and two are in Cookie.py and in both cases it's broken because set_default does 
not 
go through the same checks that __setitem__ goes through.

(The other place is an internal class in _strptime.)

In looking over existing third-party code, I see this nuance of when to use 
UserDict 
vs. dict isn't that well known.  The documentation says "The need for this 
class has 
been largely supplanted by the ability to subclass directly from dict", but 
that 
isn't true if anyone is worried about future-proofing and where the subclass 
changes 
one of the standard methods.

----------
nosy: +dalke

_____________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1367711>
_____________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to