Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> That's the only way of creating function with state without introducing closure or making an object with __call__

What about this?

  def foo():
      if not hasattr(foo, 'static_list'):
          foo.static_list = []
At least it's a bit easier to see that something funky is going on.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: