[PEAK] DecoratorTools break when optimized.
Phillip J. Eby
pje at telecommunity.com
Sun Apr 6 14:45:21 EDT 2008
At 08:08 PM 4/6/2008 +0300, Sergey Schetinin wrote:
>util/decorators.py line 304
>
> def wrap(__func):
> pass
> wrap.__doc__ = \
> '''
>For Trellis
>events/trellis.py line 353, same thing:
>
> def wrap(__func, __module):
> pass
> wrap.__doc__ = \
> """
This doesn't seem particularly scalable to me, in that everyone who
uses DecoratorTools (and whose library you then use) would have to do
this, or you will have a problem.
It seems to me that a proper fix would require an API change, so that
the docstring is replaced with a string parameter. Perhaps something
that takes a lambda, like:
wrapper = template_lambda(lambda __func, ...:
"""
body here...
"""
)
I would then also need to deprecate the current usage forms and
encourage people to stop using the old way.
I'm not so sure about the benefit of doing all this, though, since
-OO is hardly any optimization compared to -O. -O already removes
asserts and "if __debug__", so I can only imagine -OO being useful in
a very low-memory environment where the libraries have lots of large
docstrings. But it's hard to imagine such an environment where you
would *also* want to use, e.g. the Trellis, since it's not exactly
light on memory usage.
More information about the PEAK
mailing list