RE: [Python-Dev] @decoration of classes

2005-03-30 Thread Delaney, Timothy C (Timothy)
Nick Coghlan wrote: # A decorator that does not alter its argument def register(callable): # Register the callable somewhere ... return callable # Decorated factory function @register def factory(): pass # Post-decorated class class factory:

Re: [Python-Dev] @decoration of classes

2005-03-30 Thread Nick Coghlan
Michael Chermside wrote: So I'm inclined to use different tools for modifying functions and modifying classes because the ways you want to modify them are different, and decorators are tuned to what people normally want to do with functions (like simple wrapping) while metaclasses are tuned to

Re: [Python-Dev] @decoration of classes

2005-03-30 Thread Phillip J. Eby
At 10:05 AM 3/31/05 +1000, Nick Coghlan wrote: PJE's example of moving the decoration near the top of the class definition without allowing class decoration contains an important caveat: it requires that the decorators be written to support doing that. Allowing class decoration means any

Re: [Python-Dev] @decoration of classes

2005-03-30 Thread Nick Coghlan
Delaney, Timothy C (Timothy) wrote: class factory: @register def __call__(self): pass Just as an additional data point - obviously not applicable in all cases. Yep, and it's obviously possible to do that now with just function decorators. Getting my head around what that actually

Re: [Python-Dev] @decoration of classes

2005-03-28 Thread Josiah Carlson
Michael Chermside [EMAIL PROTECTED] wrote: Josiah Carlson writes: [... stuff about reST and TeX ...] While I have not used it often, I have done the equivalent of decorating classes; it is as natural (though perhaps not quite as useful initially) as decorating functions,

Re: [Python-Dev] @decoration of classes

2005-03-28 Thread Jack Diederich
On Sat, Mar 26, 2005 at 12:36:08PM -0800, Josiah Carlson wrote: Eric Nieuwland [EMAIL PROTECTED] wrote: Given the ideas so far, would it possible to: def meta(cls): ... @meta class X(...): ... It is not implemented in Python 2.4. From what I understand, making

Re: [Python-Dev] @decoration of classes

2005-03-26 Thread Eric Nieuwland
Given the ideas so far, would it possible to: def meta(cls): ... @meta class X(...): ... ?? --eric ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] @decoration of classes

2005-03-26 Thread Eric Nieuwland
On 26 mrt 2005, at 21:36, Josiah Carlson wrote: Eric Nieuwland [EMAIL PROTECTED] wrote: Given the ideas so far, would it possible to: def meta(cls): ... @meta class X(...): ... It is not implemented in Python 2.4. From what I understand, making it happen in Python 2.5 would not be

[Python-Dev] @decoration of classes

2005-03-24 Thread Jim Jewett
Josiah Carlson: I just noticed that decoration of classes was not included with the @decoration syntax that made it into Python 2.4. ... Is the fact that it didn't make it into 2.4 due to a pronouncement Yes, but it wasn't a permanent decision, and I don't think he used the magic word

Re: [Python-Dev] @decoration of classes

2005-03-24 Thread Josiah Carlson
Jim Jewett [EMAIL PROTECTED] wrote: Josiah Carlson: I just noticed that decoration of classes was not included with the @decoration syntax that made it into Python 2.4. ... Is the fact that it didn't make it into 2.4 due to a pronouncement Yes, but it wasn't a permanent decision,