Serhiy Storchaka added the comment:

The argument for not raising TypeError for unsupported types:

This is just from the definition of a set. If the set can't contain the value 
of specific type, then checking if this value is contained in the set should 
return False, and discarding it from the set should be no-op.

The argument for raising TypeError for unsupported types:

Using a value of unsuitable type is likely a programming error. Silencing 
TypeError can hide an error. Since raising and catching an exception is costly 
(but it is cheaper in C than in Python), this also can lead to performance 
degradation which is hard to catch.

If the first argument is stronger then the second argument then we should 
change a number of set, dict, dict views and OrderedDict methods and make them 
returning a reasonable result rather than raising TypeError.

If the second argument is stronger then the first argument then we should 
change just WeakSet.__contains__() and dict.pop(). Since this is a behavior 
change that can break third-party code they should first emit deprecation 
warnings for one or two releases.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30100>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to