[IronPython] .NET Attributes

Sanghyeon Seo sanxiyn at gmail.com
Tue Mar 28 06:58:59 CEST 2006


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



More information about the Ironpython-users mailing list