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-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 appropr

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 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 >cl

Re: [Python-Dev] @decoration of classes

2005-03-28 Thread Phillip J. Eby
At 07:55 PM 3/28/05 -0500, Jack Diederich wrote: For compelling, I think the code smell put off by the "no conflict" metaclass generator recipe (which also appeared in Alex Martelli's PyCon talk) is fairly compelling from a duck typing point of view. # would you rather class K: __metaclass__ = no

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

Re: [Python-Dev] @decoration of classes

2005-03-28 Thread Jack Diederich
On Mon, Mar 28, 2005 at 09:25:18AM -0800, Michael Chermside 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 d

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 function

RE: [Python-Dev] @decoration of classes

2005-03-28 Thread Michael Chermside
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, [... stuff about ice cream and sprinkles ...] Hmm...

Re: [Python-Dev] @decoration of classes

2005-03-26 Thread Jp Calderone
On Sat, 26 Mar 2005 22:49:33 +0100, Eric Nieuwland <[EMAIL PROTECTED]> wrote: >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(...): > >

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 b

Re: [Python-Dev] @decoration of classes

2005-03-26 Thread Josiah Carlson
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 terribly difficult. The qu

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: http://mail.python.org/ma

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 perman

Re: [Python-Dev] @decoration of classes

2005-03-22 Thread Anthony Baxter
On Wednesday 23 March 2005 14:20, Guido van Rossum wrote: > It would take a lot of convincing before I would think that class > @decorators are better than metaclasses. > > In any case the fact that it wasn't in the PEP was plenty of reason > not to add it to 2.4. Minor clarification - it _was_ in

Re: [Python-Dev] @decoration of classes

2005-03-22 Thread Guido van Rossum
> I just noticed that decoration of classes was not included with the > @decoration syntax that made it into Python 2.4. While I understand > that class decoration was not a part of PEP 318, I remember people were > interested in decorating classes for all sorts of reasons, among them as > a prefi