[Python-3000] Minor problem with ABCMeta?
Andrew McNamara
andrewm at object-craft.com.au
Mon Sep 1 03:53:45 CEST 2008
The __subclasscheck__ method of ABCMeta contains the following code:
# Check if it's a subclass of a registered class (recursive)
for rcls in cls._abc_registry:
if issubclass(subclass, rcls):
cls._abc_registry.add(subclass)
return True
It looks to me like this code will result in an unnecessary call to
cls._abc_registry.add() in the case that "subclass" is already in
cls._abc_registry. It looks like the code should be preceded with
something like:
if subclass in cls._abc_registry:
return True
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
More information about the Python-3000
mailing list