Matimus a écrit :
On Nov 13, 9:16 am, Joe Strout <[EMAIL PROTECTED]> wrote:
(snip)
def spam2(): if not hasattr(spam2,'count'):spam2.count=0 spam2.count += 1 return "spam2 " * spam2.countThis is definitely preferred over the first.
I beg to disagree. This solution stores "count" on *whatever* the name "spam2" resolves at runtime.
(snip) -- http://mail.python.org/mailman/listinfo/python-list