Bugs item #1575169, was opened at 2006-10-11 05:35
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1575169&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
Private: No
Submitted By: Martin Gfeller (gfe)
Assigned to: Raymond Hettinger (rhettinger)
Summary: isSequenceType returns True for dict subclasses (<> 2.3)

Initial Comment:
The following behavior is correct according to the 
documentation. However, it seems weird to me, and 
broke my code when going from 2.3 to 2.4:

Python  2.4.2:
>>> import operator
>>> class deriveddict(dict): pass
... 
>>> d =dict()
>>> dd = deriveddict()
>>> operator.isSequenceType(d)
False
>>> operator.isSequenceType(dd)
True


The last statement returns False in Python 2.3.4.






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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2006-11-27 13:28

Message:
Logged In: YES 
user_id=80475
Originator: NO

Hmm, it may be possible to make the test smarter by checking base classes
known mappings or known sequences in cases where the __getitem__ method
hasn't been overridden.  That would reduce false positives in cases like
this where there is some hint as to whether the __getitem__ method is for
mapping or for sequence behavior.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1575169&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to