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:
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
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
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
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,
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
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:
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
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
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,
10 matches
Mail list logo