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: [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>:
> 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@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to