Raymond Hettinger added the comment:
We don't normally document implementation details or the presences or absence
of internal optimizations. This gives us freedom to change the implementation
and it allows freedom for other implementations (such as Jython, IronPython,
and PyPy) to make their own choices. Often those implementations start out
with the simplest correct approach and then become increasingly optimized over
time.
I'm leaving this one open as a possible CPythhon performance enhancement,
adding early-out behavior to issubset() when the argument is a non-set,
non-dict iterable:
def issubset(self, iterable):
n = len(self)
seen = set()
for x in iterable:
if x not in seen and x in self:
seen.add(x)
n -= 1
if not n:
return True # early-out
return False
----------
components: +Interpreter Core -Documentation
type: behavior -> performance
versions: -Python 2.7, Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18032>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com