[IronPython] dictproxy.get

Sanghyeon Seo sanxiyn at gmail.com
Thu Jan 24 05:47:06 CET 2008


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



More information about the Ironpython-users mailing list