mario ruggier wrote:
On Jan 15, 4:06 pm, Steven D'Aprano <st...@remove-this-
cybersource.com.au> wrote:

Hi Steve!

class GetItemEvaluator(object):
    def __init__(self):
        self.globals = globals() # some dict (never changes)

Ya, this is just a boiled down sample, and for simplicity I set to to
the real globals(), so of course it will change when that changes...
but in the application this is a distinct dict, that is entirely
managed by the application, and it never changes as a result of an
*evaluation*.

It would have been less confusing if you had written

             self.globals = {} # a constant dict
or even
            self.constants = {} # empty here only for simplicity

This might also make the 3.0 error message clearer (see other post).

tjr

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

Reply via email to