[Python-Dev] Re: new syntax for wrapping (PEP 318)
Skip Montanaro
skip at pobox.com
Wed Feb 25 17:37:26 EST 2004
Mark> Just a data point from a user: I use classmethod fairly
Mark> frequently, and I would *love* to see some syntax to support it.
Mark> As has been pointed out before, classmethod (and staticmethod) are
Mark> a part of the interface of a function, and shouldn't be tacked on
Mark> to the end of the body. Please let me put them where people (and
Mark> hopefully pydoc and pychecker) can easily see them.
Mark> I marginally prefer [] to "as", but I don't have strong feelings
Mark> either way. Both seem quite readable and pythonic to me.
I'll add another data point. Quixote'd PTL uses almost this exact syntax to
distinguish between PTL functions/methods which return HTML or plain text.
The only difference is that it places the annotation before the argument
list:
def head [html] (title):
'''
<head>
<title>%(title)s</title>
''' % locals()
threecol_css()
'</head>'
I haven't heard any Quixote users complain about the construct. (I don't
know if PTL supports more than one annotation per function or not. I think
the only choices are currently "html" or "text", which are obviously
mutually exclusive.)
Skip
More information about the Python-Dev
mailing list