[IronPython] .NET Attributes

Dino Viehland dinov at exchange.microsoft.com
Tue Mar 28 07:44:56 CEST 2006


I like this too...  It's interesting that while the syntax isn't exactly the same for giving both classes & functions attributes they are both getting that information in the same way.  I was previously worried about the differences between classes & functions but I think this brings it all together.

________________________________________
From: users-bounces at lists.ironpython.com On Behalf Of Sanghyeon Seo
Sent: Monday, March 27, 2006 8:58 PM
To: Discussion of IronPython
Subject: Re: [IronPython] .NET Attributes

2006/3/28, Sanghyeon Seo <sanxiyn at gmail.com>:
> I like __attributes__ solution.

As pointed out already, decorators can't be used with classes as of
2.4. But __attributes__ can be attached to classes or functions.

I agree that decorators would be nice. Perhaps something like the
following in clr module?

def f(arg):
  pass
f.__attributes__ = [Foo(), Bar(1)]

equivalent to:

@attributes(Foo(), Bar(1))
def f(arg):
  pass

where

cool_attributes = attributes(Foo(), Bar(1))

@cool_attributes
def f(arg):
  pass

@cool_attributes
def g(arg):
  pass

is possible.

Just my 2c.

Seo Sanghyeon
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list