Re: Changing return of type(obj)

2009-02-08 Thread Pekka Klärck
2009/2/6 Ken Elkabany k...@elkabany.com: I am attempting to fully-simulate an 'int' object with a custom object type. It is part of a library I am creating for python futures and promises. Is there anyway such that type(my_object) can return type 'int'? If it's enough to change how the type

Changing return of type(obj)

2009-02-06 Thread Ken Elkabany
Hello, I am attempting to fully-simulate an 'int' object with a custom object type. It is part of a library I am creating for python futures and promises. Is there anyway such that type(my_object) can return type 'int'? Or for that matter, any other primitive? I do not care how dirty the solution

Re: Changing return of type(obj)

2009-02-06 Thread Chris Rebert
On Fri, Feb 6, 2009 at 3:03 AM, Ken Elkabany k...@elkabany.com wrote: Hello, I am attempting to fully-simulate an 'int' object with a custom object type. It is part of a library I am creating for python futures and promises. Is there anyway such that type(my_object) can return type 'int'? Or

Re: Changing return of type(obj)

2009-02-06 Thread Christian Heimes
Ken Elkabany schrieb: I would simply subclass 'int', but this object needs to be general enough to pretend to be an 'int', 'NoneType', 'str', etc... A long shot: Can I change the base class on an instance by instance basis depending on the need? Well, now I can imagine having a class factory

Re: Changing return of type(obj)

2009-02-06 Thread Ken Elkabany
I would simply subclass 'int', but this object needs to be general enough to pretend to be an 'int', 'NoneType', 'str', etc... A long shot: Can I change the base class on an instance by instance basis depending on the need? Well, now I can imagine having a class factory that will spawn for me the

Re: Changing return of type(obj)

2009-02-06 Thread Terry Reedy
Ken Elkabany wrote: Hello, I am attempting to fully-simulate an 'int' object with a custom object type. It is part of a library I am creating for python futures and promises. Is there anyway such that type(my_object) can return type 'int'? Or for that matter, any other primitive? I do not