I was able to resolve the error by explicitly naming the class in the
dictionary lookup inside __new__:

        if candid in CandidateAuto.instances:
            return candid

I'm curious why this is necessary though. From our earlier dicussions
(and from other reading), I thought that by declaring a static class
attribute, that it would automatically become available to an
instances of that class. My impression was that that a method
searches for the variables/attributes in it's local scope, and failing
to find it there, would bubble up to the class level and find the
static variable there.

Is that not correct?
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to