[IronPython] IPy2b5 - different types with same name are considered equal

Ronnie Maor ronnie.maor at gmail.com
Mon Sep 22 19:27:43 CEST 2008


sure.
this issue isn't a big problem for me, so workaround should be fine until
you fix it.

On Mon, Sep 22, 2008 at 5:50 PM, Curt Hagenlocher <curt at hagenlocher.org>wrote:

> A shorter repro of the same problem:
>
> class A(object): pass
> X = A
> class A(object): pass
> X == A
>
> If you need a temporary workaround for this, you can compare id(type(x))
> instead of the type(x).
>
> On Mon, Sep 22, 2008 at 7:56 AM, Ronnie Maor <ronnie.maor at gmail.com>wrote:
>
>> class A(object):
>>     def foo(self): print "original A"
>> orig = A()
>>
>> class A(object):
>>     def foo(self): print "new A"
>> new = A()
>>
>> if type(orig) == type(new):
>>     print "types are equal"
>> else:
>>     print "types are not equal"
>>
>> orig.foo()
>> new.foo()
>>
>> --------
>>
>> on CPython and IPy 1.1 the output is:
>> types are not equal
>> original A
>> new A
>>
>> on IPy 2.0 b5:
>> types are equal
>> original A
>> new A
>>
>> I actually run into this case when testing code that upgrades persistent
>> pickles to newer version of the class.
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080922/e13797f0/attachment.html>


More information about the Ironpython-users mailing list