On Fri, 2004-03-26 at 10:10, Guido van Rossum wrote: > (2) Invent some other notation for setting function attributes as part > of the function *body*, before the doc string even. > > For (2) I am thinking aloud here: > > def foobar(self, arg): > @author: "Guido van Rossum" > @deprecated > pass The way I /want/ to spell this is something like: def foobar(self, arg): foobar.author = 'Guido van Rossum' foobar.deprecated = True I know all the practical problems with this suggestion, but to me, that's the most natural spelling. I suppose something like this might also not be horrible: def foobar [ .author = 'Guido van Rossum' .deprecated = True classmethod ] (self, arg) Naw, these probably don't mix well. Hmm, def foobar { author = 'Guido van Rossum' deprecated = True } [classmethod, spoogemethod, insanity ] (self, arg): # Now what the heck does this thing do? Blech. OTOH, I'm all for trying to get a more natural way of spelling function attributes, but decorators can also do the trick in a nasty way: def foobar [ lambda f: f.author = 'Guido van Rossum', lambda f: f.deprecated = True, classmethod] (self, arg): # Now what? It's way past my bedtime <wink> so ignore my babbling. -Barry
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4