[Python-Dev] decorator module patch
Georg Brandl
g.brandl at gmx.net
Sun Mar 12 23:11:31 CET 2006
Nick Coghlan wrote:
> Alex Martelli wrote:
>> On Mar 12, 2006, at 11:16 AM, Ian Bicking wrote:
>> ...
>>> memoize seems to fit into functools fairly well, though deprecated not
>>> so much. functools is similarly named to itertools, another module
>>> that
>>> is kind of vague in scope (though functools is much more vague).
>>> partial would make just as much sense in functools as in functional.
>>
>> Couldn't we merge functools and functional into just one (user-
>> visible) module? The distinction between what goes into one vs the
>> other is exceedingly subtle and poor users will be guessing as to
>> what's where. If we need a mixed module with something in C and
>> something in Python, we can do it the usual way, func.py wrapping
>> _func.pyd (or .so or whatever)...
>
>
> I agree it makes sense to have "decorator", "memoize", "deprecated" and
> "partial" all being members of the same module, whether the name be
> "functools" or "functional" (although I have a slight preference for
> "functools" due to the parallel with "itertools").
+1 from me. I'll happily make the according changes if that reaches a consensus.
> On the question of whether or not deprecated fits in as a function tool, I
> know I'd tend to only use it on functions (to deprecate a class, I'd simply
> decorate the class's __init__ or __new__ method).
I suppose it would be okay, since as a decorator it can only be applied to
functions.
In PEP 356, there is even a suggestion to "add builtin @deprecated decorator?".
Cheers,
Georg
More information about the Python-Dev
mailing list