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 *
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
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
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
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
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
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
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
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...
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(...):
> >
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
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
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
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
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
> 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
16 matches
Mail list logo