__name__ becoming read-write?
Arthur
ajsiegel at optonline.com
Mon Aug 23 19:17:25 EDT 2004
On Tue, 24 Aug 2004 03:17:42 +1000, Anthony Baxter
<anthonybaxter at gmail.com> wrote:
>On Mon, 23 Aug 2004 17:00:39 GMT, Arthur <ajsiegel at optonline.com> wrote:
>> I see the point.
>>
>> But.. there is always a but.
>>
>> I'm thinking now a special sytnax item in the __form__ at the top of
>> function that would:
>>
>> 1) put one on notice that the function is to be transformed (as in
>> "see below").
>>
>> 2) allow a name to be assigned to it, which will become the
>> transform's __name__.
>
>This is a bad idea - code inside the function should be executed when
>the function is executed. docstrings are a special-case (because
>they're not actually code),
Well - accepted that you identify this issue.
I would be curious if you could see the sense of the apporach I am
suggesting outside of this issue.
>
>def doc(str):
> def endoculate(func, str=str):
> func.__doc__ = str
> return func
>
>def frobulate(metawhatsit):
I am old enough - I think - to have been frobutaling metawhatsits
since before you were born. But have not been, as it happens. So I
recognize that my solution might be a bit frobulated -technically.
A little fortipation is perhaps all it needs, though.
>Paul Morrow's idea of special magic __foo__ inside the function is
>deeply magical, and not likely to make any new users running across it
>any happier.
Well I still see - by far - that best fallback position as A1 (the
alpha 2 implementation) - precisely because it implies black magic.
At least to me.
The least thing I want to see is sweeter, more embedded syntax for
this stuff.
So I am totally off the "how do we improve the syntax" bus.
> "So wait, this stuff that _looks_ like code in a
>function, isn't actually? what the hell?" The new syntax[1] for
>decorators is at least very obvious that something _new_ is going on.
I am thinking (and I think Paul is thinking) that we can say the same
thing, succintly, in a manner that has precedence in the language
Mine's a one-liner that does not totally relieve the magicians burden
to be - somwhere down the line - a bit expressive
Art
More information about the Python-list
mailing list