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.count


This 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

Reply via email to