I'm not very familiar with Python, so please explain me why should
containers be used?
For example in one of Paul Graham's essays there's an example of
'generator of accumulators' in Python:

def foo(n):
    s = [n]
    def bar(i):
         s[0] += i
         return s[0]
    return bar

1) So, why just using 's = n' is not suitable? (It doesn't work, Python
'doesn't see' s, but why?)
2) Is 'foo.s = n' a correct solution? It seems to be a little more
elegant.  (I tested it, and it worked well)

Sorry for possibly stupid questions.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to