[IronPython] .NET attributes
cwmoad at gmail.com
Fri Sep 15 15:16:56 CEST 2006
On 9/14/06, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> We're tentatively thinking that this is a 2.0 feature but if we figured out a syntax we really liked we'd try to get it into 1.1.
It seems as if there are two clean ways to do this in my mind.
1. Use python2.4's decorator sytax and extend it to allow class and
class variable attribute declaration. This has the pitfall of
breaking cpython compatibility with decorators though. At the same
time, why use decorators when you can use attributes?
2. Thinking about this problem brings me back to an elegant solution
that Philip Eby came up with to allow python2.3 users to use
decorators for turbogears.
def method(): ...
Granted special logic has to be added to the decorator method. This
prompted me to try:
from System.Web.Services import *
The advantage here is syntactically correct python. IP could just add
some special logic to apply the attributes. Another advantage is that
it matches the sytax of C# attributes. Evil programmers could even
apply decorators and attributes to a method!
More information about the Ironpython-users