Re: Dynamically replacing an objects __class__; is it safe?

2017-03-17 Thread jladasky
On Thursday, March 16, 2017 at 7:07:17 PM UTC-7, Deborah Swanson wrote: > Steve D'Aprano wrote,on March 16, 2017 5:07 AM > > > > On Thu, 16 Mar 2017 09:03 am, Gregory Ewing wrote: > > > > > Steve D'Aprano wrote: > > >> You probably can't make a whale fly just by changing the class to > > >>

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-17 Thread Chris Angelico
On Sat, Mar 18, 2017 at 8:24 AM, wrote: > On Thursday, March 16, 2017 at 9:27:56 PM UTC-7, Gregory Ewing wrote: >> Chris Angelico wrote: >> > Maybe what the ISS does isn't flying - it's falling with style? >> >> Yep. They didn't really launch it into orbit with rockets, >> that

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-17 Thread jladasky
On Thursday, March 16, 2017 at 9:27:56 PM UTC-7, Gregory Ewing wrote: > Chris Angelico wrote: > > Maybe what the ISS does isn't flying - it's falling with style? > > Yep. They didn't really launch it into orbit with rockets, > that was all faked. They actually hauled it up there with > a crane,

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-17 Thread Tony van der Hoff
On 17/03/17 04:18, Gregory Ewing wrote: Dennis Lee Bieber wrote: I'd say satellites do "not" fly, as they have no force/action opposing the fall caused by the pull of gravity. Arrows, bullets, thrown stones, etc. are often said to be flying. Seems to me the word gets applied to anything

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Gregory Ewing
Chris Angelico wrote: Maybe what the ISS does isn't flying - it's falling with style? Yep. They didn't really launch it into orbit with rockets, that was all faked. They actually hauled it up there with a crane, let it go and pulled the earth away at the last moment. -- Greg --

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Gregory Ewing
Dennis Lee Bieber wrote: I'd say satellites do "not" fly, as they have no force/action opposing the fall caused by the pull of gravity. Arrows, bullets, thrown stones, etc. are often said to be flying. Seems to me the word gets applied to anything that is moving while not contacting

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Chris Angelico
On Fri, Mar 17, 2017 at 1:52 PM, Ian Kelly wrote: > On Thu, Mar 16, 2017 at 7:56 PM, Dennis Lee Bieber > wrote: >> On Fri, 17 Mar 2017 10:03:04 +1300, Gregory Ewing >> declaimed the following: >> >>>Chris Angelico wrote:

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Ian Kelly
On Thu, Mar 16, 2017 at 7:56 PM, Dennis Lee Bieber wrote: > On Fri, 17 Mar 2017 10:03:04 +1300, Gregory Ewing > declaimed the following: > >>Chris Angelico wrote: >>> I just asked my father, and he believes that a satellite DOES fly, on >>> the

RE: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Deborah Swanson
Steve D'Aprano wrote,on March 16, 2017 5:07 AM > > On Thu, 16 Mar 2017 09:03 am, Gregory Ewing wrote: > > > Steve D'Aprano wrote: > >> You probably can't make a whale fly just by changing the class to > >> bird. It will need wings, and feathers, at the very least. > > > > Some things succeed

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Gregory Ewing
Chris Angelico wrote: I just asked my father, and he believes that a satellite DOES fly, on the basis that it is perpetually falling and forever missing the ground. Also, NASA people talk about "flying" the ISS, so it seems your father is in good company. -- Greg --

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread alister
On Thu, 16 Mar 2017 14:04:19 +, Jon Ribbens wrote: > On 2017-03-16, Robin Becker wrote: >> On 15/03/2017 13:53, Steve D'Aprano wrote: >>> You probably can't make a whale fly just by changing the class to >>> bird. It will need wings, and feathers, at the very least. >>

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Chris Green
Robin Becker wrote: > On 16/03/2017 14:03, D'Arcy Cain wrote: > > On 2017-03-16 09:45 AM, Robin Becker wrote: > >> On 15/03/2017 13:53, Steve D'Aprano wrote: > >>> You probably can't make a whale fly just by changing the class to > >>> bird. It > >>> will need wings, and

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Chris Angelico
On Fri, Mar 17, 2017 at 1:21 AM, Robin Becker wrote: >> Falling is not the same as flying unless you accidentally miss the ground. >> > well in English an arrow flies as well as time, the whale was very > interested in the approaching ground and perhaps forgot to conjure up >

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Robin Becker
On 16/03/2017 14:03, D'Arcy Cain wrote: On 2017-03-16 09:45 AM, Robin Becker wrote: On 15/03/2017 13:53, Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. the whale in the Hitchhiker's Guide

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Tony van der Hoff
On 16/03/17 13:45, Robin Becker wrote: On 15/03/2017 13:53, Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. the whale in the Hitchhiker's Guide found itself flying without feathers or wings It

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Jon Ribbens
On 2017-03-16, Robin Becker wrote: > On 15/03/2017 13:53, Steve D'Aprano wrote: >> You probably can't make a whale fly just by changing the class to bird. It >> will need wings, and feathers, at the very least. > > the whale in the Hitchhiker's Guide found itself flying

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread D'Arcy Cain
On 2017-03-16 09:45 AM, Robin Becker wrote: On 15/03/2017 13:53, Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. the whale in the Hitchhiker's Guide found itself flying without feathers or wings

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Robin Becker
On 15/03/2017 13:53, Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. the whale in the Hitchhiker's Guide found itself flying without feathers or wings -- Robin Becker --

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Steve D'Aprano
On Thu, 16 Mar 2017 09:03 am, Gregory Ewing wrote: > Steve D'Aprano wrote: >> You probably can't make a whale fly just by changing the class to bird. >> It will need wings, and feathers, at the very least. > > Some things succeed in flying with neither wings nor feathers. > Helicopters, for

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread alister
On Wed, 15 Mar 2017 19:10:17 -0700, Deborah Swanson wrote: > MRAB wrote, on Wednesday, March 15, 2017 3:19 PM >> >> On 2017-03-15 22:03, Gregory Ewing wrote: >> > Steve D'Aprano wrote: >> >> You probably can't make a whale fly just by changing the class to >> >> bird. It will need wings, and

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread alister
On Thu, 16 Mar 2017 11:03:56 +1300, Gregory Ewing wrote: > Steve D'Aprano wrote: >> You probably can't make a whale fly just by changing the class to bird. >> It will need wings, and feathers, at the very least. > > Some things succeed in flying with neither wings nor feathers. > Helicopters,

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Gregory Ewing
MRAB wrote: Could you argue that the blades were a kind of wing? After all, they rely on the same principle of moving through the air to produce lift. Balloons, on the other hand, ... :-) Also rockets. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

RE: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Deborah Swanson
MRAB wrote, on Wednesday, March 15, 2017 3:19 PM > > On 2017-03-15 22:03, Gregory Ewing wrote: > > Steve D'Aprano wrote: > >> You probably can't make a whale fly just by changing the class to > >> bird. It will need wings, and feathers, at the very least. > > > > Some things succeed in flying

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Chris Angelico
On Thu, Mar 16, 2017 at 9:19 AM, MRAB wrote: > On 2017-03-15 22:03, Gregory Ewing wrote: >> >> Steve D'Aprano wrote: >>> >>> You probably can't make a whale fly just by changing the class to bird. >>> It >>> will need wings, and feathers, at the very least. >> >> >>

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread MRAB
On 2017-03-15 22:03, Gregory Ewing wrote: Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. Some things succeed in flying with neither wings nor feathers. Helicopters, for example. Could you

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Chris Angelico
On Thu, Mar 16, 2017 at 9:03 AM, Gregory Ewing wrote: > Steve D'Aprano wrote: >> >> You probably can't make a whale fly just by changing the class to bird. It >> will need wings, and feathers, at the very least. > > > Some things succeed in flying with neither wings

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Gregory Ewing
Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. Some things succeed in flying with neither wings nor feathers. Helicopters, for example. -- Greg --

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread gst
Hi, You can subclass M2 from M1 and override only what you need. Regards, -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Steve D'Aprano
On Wed, 15 Mar 2017 08:54 pm, marco.naw...@colosso.nl wrote: > Dear All, > > Summary of the question: > Is it generally safe to dynamically change an objects class; if not > under which conditions can it be considered safe. *Generally* safe? No. You cannot expect to take an arbitrary object and

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread marco . nawijn
On Wednesday, March 15, 2017 at 11:33:56 AM UTC+1, Peter Otten wrote: > marco.naw...@colosso.nl wrote: > > > Dear All, > > > > Summary of the question: > > Is it generally safe to dynamically change an objects class; if not > > under which conditions can it be considered safe. > > > > Context:

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Peter Otten
marco.naw...@colosso.nl wrote: > Dear All, > > Summary of the question: > Is it generally safe to dynamically change an objects class; if not > under which conditions can it be considered safe. > > Context: > Given the code below, I have no direct control over Base and M1. M1 > is a

Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread marco . nawijn
Dear All, Summary of the question: Is it generally safe to dynamically change an objects class; if not under which conditions can it be considered safe. Context: Given the code below, I have no direct control over Base and M1. M1 is a instantiated by 'calling' the read-only property of Base. I