Re[2]: [Python-Dev] syntactic sugar idea for {static,class}methods (original) (raw)

Michael Hudson mwh@python.net
15 Feb 2002 10:29:59 +0000


Gareth McCaughan <gmccaughan@synaptics-uk.com> writes:

On Fri, 15 Feb 2002 04:25:55 -0500, Oren Tirosh <oren-py-d@hishome.net> wrote: > The modifier order [memoize, staticmethod] sounds more like the sentence > "foo is a memoized staticmethod" - at least in English it does. In French, > Hebrew and several other languages it's the other way around, but Python > is definitely English-oriented.

Interesting. I read it more as: "Define a function, then memoize it and make it a static method".

That's what my patch does, too, but I can't remember whether this was by accident or design :-/.

Incidentally, I'm not sure

class C: def s(): print 1 s = memoize(staticmethod(s))

would actually work (s would have type 'function'). I guess memoize could made cleverer than the version I posted.

Cheers, M.

-- "declare"? my bogometer indicates that you're really programming in some other language and trying to force Common Lisp into your mindset. this won't work. -- Erik Naggum, comp.lang.lisp