Are decorators really that different from metaclasses...

Arthur ajsiegel at
Fri Aug 27 02:00:23 CEST 2004

On 26 Aug 2004 15:20:10 -0700, jess.austin at (Jess Austin)

>Paul Morrow <pm_mon at> wrote in message news:<mailman.2423.1093527121.5135.python-list at>...
>> Currently, you can change a doc string outside of a function, by 
>> modifying the function's __doc__ attribute
>> IMO, to change it inside of a function def should be (but isn't) as easy 
>> as...
>>    >>> def foo():
>>    ...     """ I am foo """
>>    ...     __doc__ = __doc__ + 'indeed'
>I'm not trying to be mean, but why not use a class for this?  

I believe he was only being illustrative.

My use case:
(unless I'm being stupid)

IDLE 1.0.3      
>>>class foo:
              hint ="boo"
	def bar(self):
		"bar using %s" %hint

>>> f=foo()
>>> print


>>> class foo:
	hint ="boo"
	def bar(self):
	bar.__doc__="bar using %s" %hint

>>> f=foo()
>>> print
bar using boo

But to me more important, in the context of the overall discussion, is
in seeing some good connectedness between the problem of being forced
outside and below the function to use string substitution on its
docstring, and the limited range of options that seem to be available
to try to solve the percieved syntax problems related to
transformations (pre a2) being stuck outside and below.

Is the apparent connectedness only skin deep?  

It's not making sense to me that is.


More information about the Python-list mailing list