IronPython 2 reports: AttributeError: 'dictproxy' object has no attribute 'get'
Note: works fine on IronPython 1.

class Singleton(object):
    def __new__(cls):
        obj = Singleton.__dict__.get(cls.__name__)
        if obj is None:
            obj = object()
            setattr(Singleton, cls.__name__, obj)
        return obj

class X(Singleton):
    pass

a = X()
b = X()
c = Singleton.X
assert a is b
assert a is c

-- 
Seo Sanghyeon
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to