Andrey Fedorov wrote:
> On Wed, Mar 10, 2010 at 12:24 AM, Rami Chowdhury
> mailto:rami.chowdh...@gmail.com>> wrote:
>
> Could you tell us *why* you need to down-cast x? Explicit
> type-casting is usually unnecessary in Python...
>
>
> Sure! It's related to the longer question I unwisely
On Wed, Mar 10, 2010 at 12:24 AM, Rami Chowdhury
wrote:
> Could you tell us *why* you need to down-cast x? Explicit type-casting is
> usually unnecessary in Python...
Sure! It's related to the longer question I unwisely asked during PyCon [1]
(when no one had time to read it, I suppose).
I hav
En Tue, 09 Mar 2010 18:26:52 -0300, Andrey Fedorov
escribió:
So I have `x', a instance of class `Foo'. I also have class `Bar', a
class
extending `Foo' with a couple of methods. I'd like to "down cast" x as
efficiently as possible. Is it OK to just set `x.__class__ = Bar' and
expect
thin
On Mar 9, 2010, at 13:26 , Andrey Fedorov wrote:
> So I have `x', a instance of class `Foo'. I also have class `Bar', a class
> extending `Foo' with a couple of methods. I'd like to "down cast" x as
> efficiently as possible. Is it OK to just set `x.__class__ = Bar' and expect
> things to work
So I have `x', a instance of class `Foo'. I also have class `Bar', a class
extending `Foo' with a couple of methods. I'd like to "down cast" x as
efficiently as possible. Is it OK to just set `x.__class__ = Bar' and expect
things to work OK in all major versions of CPython?
--
http://mail.python.o