Caleb Levy added the comment:
@serhiy.storchaka: I don't think that will work.
First of all,
x, y = item
will raise a ValueError if fed an iterable whose length is not exactly 2, so
you would have to check for that. Moreover, if item is something like a dict,
for example, then:
{"a": 1, "b": 2} in DictLikeMapping(a="b")
could return True, which I don't think would be expected behavior.
I'm not terribly fond of the instance check myself, but in this case I can't
see any other way to do it: the built in dict_items necessarily consists of
*tuples* of key-value pairs.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24434>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com