[issue7830] Flatten nested functools.partial
Alexander Belopolsky
report at bugs.python.org
Tue Feb 2 03:04:20 CET 2010
Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:
Antoine> Flattening should only happen for instances of the exact type.
I am attaching a variant of the patch that will only flatten if both nested and wrapping partial is of the exact type. Other possibilities would include flattening partial_subtype(f, ...) if type(f) == partial and if type(f) == partial_subtype, but I'll present only the least and most conservative variants.
Antoine> When people create subclasses [of partial type], there's usually a reason for it.
It is hard not to agree with this thesis, but I don't see how it follows that subclass writers will not benefit from flattening their instances. Can you suggest a use case where flattening in functools.partial subtype would be undesirable?
----------
Added file: http://bugs.python.org/file16091/no-nested-partial-exact.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7830>
_______________________________________
More information about the Python-bugs-list
mailing list