[IronPython] .NET attributes
Michael Foord
fuzzyman at voidspace.org.uk
Fri Sep 15 15:15:10 PDT 2006
Dino Viehland wrote:
> Unfortunately, CPython only allows the decorator syntax before a function declaration... You could always manually call the decorator function w/ the class object and see what you get back though.
>
> Charlie's earlier point about all the different targets is a really good one though - worse than even properties are things like arguments, return types, etc... that won't fit in at all w/ decorators. You could imagine allowing the syntax anywhere, but there'd be no way to disambiguate between a return decorator and a function decorator in Python.
>
It's uglier, but what about providing built in functions for applying
attributes. A specific built-in could apply return attributes etc.
This at least avoids the problem of adding a syntax that is incompatible
with CPython.
Michael Foord
http://www.voidspace.org.uk/python/index.shtml
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Charlie Moad
> Sent: Friday, September 15, 2006 7:46 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] .NET attributes
>
> On 9/15/06, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
>
>> Charlie Moad wrote:
>>
>>>> Take away decorator support and you'll lose at least this Python
>>>> programmer...
>>>> Decorators and attributes have at least some commonality, which is
>>>> why this syntax ended up in Python in the first place...
>>>> Allowing decorator syntax in places CPython doesn't is better than
>>>> not allowing it where it does...
>>>>
>>>>
>>> So it sounds like people want decorator syntax for attributes.
>>> Would it be sufficient to check for inheritance from
>>> System.Attribute to distinguish the two?
>>>
>> Sounds very good.
>>
>>
>>> Also attributes being classes and decorators functions might help.
>>>
>
>
>> Can't CPython decorators also be classes (I haven't tried this) ?
>>
>
> Callable classes I suppose....
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.4/448 - Release Date: 14/09/2006
More information about the users
mailing list