Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
leohutson
on March 2, 2014
|
parent
|
context
|
favorite
| on:
A brief history of one line fixes
> 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:
What about this?
At least it's a bit easier to see that something funky is going on.