[Python-Dev] Re: decorators and 2.4
Jeff Bone
jbone at place.org
Sat Jun 26 17:50:27 EDT 2004
On Jun 26, 2004, at 10:27 AM, Phillip J. Eby wrote:
> Actually, he very well might, and a number of other people definitely
> do. One use case repeatedly mentioned on Python-Dev has been to
> register functions or classes with frameworks, therefore definitely
> involving a literal side-effect (i.e. modification to an unrelated
> data structure).
IMHO, the fact that this results in a modification to a data structure
in framework code is an implementation detail; conceptually it can be
argued that this is *still not a side-effect* --- you are in essence
*saying something about* the function or object in question, not
expressing something algorithmic. My fear is that we end up seeing
stuff like this:
[SomeDecorator(someFreeVariable=Assignment)]
def foo(...):
x = someFreeVariable
...
My biggest concern in all this is that we end up muddying up
readability and clarity by trying to improve it.
> (I wonder if I should submit a patch for PEP 318 to add this to the
> motivation section, because it seems a lot of people keep repeating
> this "no side-effects metadata" misconception.)
I think that before we "clarify" the PEP that the intent here *is* to
allow side-effects we should get some clarity on what a side-effect
*is.* Clearly there's enough lack of consensus about this; perhaps we
need to see more examples of how various folks would use it.
jb
More information about the Python-Dev
mailing list