Possible PEP: Improve classmethod/staticmethod syntax
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Wed Jun 4 12:54:55 EDT 2003
Duncan Booth <duncan at NOSPAMrcp.co.uk> wrote previously:
|> def fooDoc(f):
|> f.__doc__ = "Bob's your uncle."
|> return f
|> class Klass(object):
|> def meth(this, that) [fooDoc]:
|> pass
|Or better:
|
|def Doc(docstring, **kw):
| def fDoc(f):
| f.__doc__ = docstring
| f.__dict__.update(kw)
| return f
|class Klass(object):
| def meth(this, that) [Doc("Bob's your uncle.", Author="me")]:
| pass
I don't understand this version. I see the idea that you want to pass
arguments to the "function constructor"--but where does the name 'fDoc'
come from? How does 'Doc()' know to call 'fDoc()' (which I presume it
wants to)?
Yours, Lulu...
--
_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY: Postmodern Enterprises _/_/_/
_/_/ ~~~~~~~~~~~~~~~~~~~~[mertz at gnosis.cx]~~~~~~~~~~~~~~~~~~~~~ _/_/
_/_/ The opinions expressed here must be those of my employer... _/_/
_/_/_/_/_/_/_/_/_/_/ Surely you don't think that *I* believe them! _/_/
More information about the Python-list
mailing list