Re: Changing return of type(obj)

2009-02-08 Thread Pekka Klärck
2009/2/6 Ken Elkabany : > > 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 ? If it's enough to change how the type looks like you can simply

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 'int'>? Or for that matter, any other primitive? I do not care how

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 factor

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 c

Re: Changing return of type(obj)

2009-02-06 Thread Chris Rebert
On Fri, Feb 6, 2009 at 3:03 AM, 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 ? Or for that > matter, any

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 ? Or for that matter, any other primitive? I do not care how dirty the solution might poss