In article <87txbg48kd....@elektro.pacujo.net>, Marko Rauhamaa <ma...@pacujo.net> wrote:
> Michael Torrie <torr...@gmail.com>: > > > I don't see why == wouldn't continue to work if os.POSIX_FADV_RANDOM > > became an object of a different type. > > It probably would. > > If one were begging for trouble, one *could* define: > > class ABC: > A = 1 > B = 1.0 > C = 1+0j > > Now: > > ABC.A == ABC.B > ABC.B == ABC.C > ABC.C == ABC.A > > but: > > ABC.A is not ABC.B > ABC.B is not ABC.C > ABC.C is not ABC.A > > > Marko On can do all sorts of bizarre things. If you wish to shoot yourself in the foot, Python is happy to provide the gun. class ABC(object): _instance = None def __new__(cls): if cls._instance is None: i = object.__new__(cls) i.__class__ = ABC cls._instance = i return cls._instance def __eq__(self, other): return False a = ABC() b = ABC() print a is b print a == b -- https://mail.python.org/mailman/listinfo/python-list