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 -- https://mail.py

Re: The ternaery operator

2017-03-16 Thread Gregory Ewing
Stefan Ram wrote: A postponed »if« can be found (x if a, otherwise y), but a preceding »if« (if a, x, otherwise y) also is found often. Yes, both forms occur in English. The point is that Guido didn't just make the idea up, it was inspired by natural language. -- Greg -- https://mail.pytho

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 th

How to add a built-in library in pyhton

2017-03-16 Thread chenchao
Hello, everybody: I use python2.7.10 and want to add a c language library in python. So how can i built it as a built-in module in python? -- https://mail.python.org/mailman/listinfo/python-list

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: I just asked my father, and he believes that a satellite DOES fly, on

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 basis that it is perpetually falling and forever mis

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 in

Re: SimpleHTTPServer and CgiHTTPServer in practice

2017-03-16 Thread Paul Rubin
Lutz Horn writes: > We don't know *why* those people told you not to use these modules. We > also don't know your use case. So it is very hard to advise you. The use case is to have a very easily set up way to serve basic pages and files, without a lot of configuration files and other infrastruct

Re: The ternaery operator

2017-03-16 Thread Chris Angelico
On Fri, Mar 17, 2017 at 10:45 AM, Stefan Ram wrote: > Gregory Ewing writes: >>wear(red_shirt if it_is_tuesday else green_shirt) > > Operators in Python usually are written with special > symbols, not with words, so a word usually indicates, > "This is not an operator.". > Non-operators lik

Re: The ternaery operator

2017-03-16 Thread Gregory Ewing
Tobiah wrote: To be fair, the proper comparison would be: If it's Tuesday, I wear my red shirt, else my green one. The Python analog of that would be if it_is_tuesday: wear(red_shirt) else: wear(green_shirt) i.e. a statement rather than an expression. We're

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 -- https://mail.python.org/mai

Doing it Wrong: python-ldap and delete operations using ldifWriter

2017-03-16 Thread chloe . anna . talbot
I want to do (what I thought) would be quite a simple thing. I have an LDAP entry that looks like this(in LDIF format): dn: cn=myorg,ou=teams,ou=groups,o=company,c=us cn: myorg objectClass: top objectClass: CompanyTeams objectClass: groupOfUniqueNames owner: cn=john,ou=people,o=company,c=us uniqu

Re: SimpleHTTPServer and CgiHTTPServer in practice

2017-03-16 Thread sjmsoft
For a couple of years we've used SimpleHTTPServer to serve pages to internal users at low volumes, and we find it to be reliable and trivial to set up. We have not subjected it to a rigorous security assessment. HTH, Steve J. Martin -- https://mail.python.org/mailman/listinfo/python-list

Re: The ternaery operator

2017-03-16 Thread Jussi Piitulainen
William Mayor writes: >> I think it would be nice to have a way of getting the 'true' value as >> the return with an optional value if false. The desire comes about >> when the thing I'm comparing is an element of a collection: >> >>drugs['choice'] if drugs['choice'] else 'pot' >> >> Th

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. >> >> the whale in the Hit

Re: The ternaery operator

2017-03-16 Thread alister
On Thu, 16 Mar 2017 03:12:32 +, Stefan Ram wrote: > The syntax > > a if c else b > > looks as if Guido made it intentionally ugly so that it will not be > used? > > Being able to detect patterns that are in widespread use among > programming languages enhances readability. > > II

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 feathers, at the very leas

Re: The ternaery operator

2017-03-16 Thread William Mayor
> > I think it would be nice to have a way of getting the 'true' > value as the return with an optional value if false. The desire > comes about when the thing I'm comparing is an element of a collection: > >drugs['choice'] if drugs['choice'] else 'pot' > > Then I'm tempted to do: > >

Re: The ternaery operator

2017-03-16 Thread Tobiah
On 03/16/2017 01:12 AM, Gregory Ewing wrote: > Stefan Ram wrote: > >> a if c else b >> >> Guido has invented something totally new. Why? > > It's arguably closer to the way you would say such a > thing in English. > > Consider the following sentences: > > "I wear my red shirt if it's Tuesday,

Re: The ternaery operator

2017-03-16 Thread Tobiah
On 03/16/2017 01:12 AM, Gregory Ewing wrote: > Stefan Ram wrote: > >> a if c else b >> >> Guido has invented something totally new. Why? > > It's arguably closer to the way you would say such a > thing in English. > > Consider the following sentences: > > "I wear my red shirt if it's Tuesday,

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 > virtual wings or rock

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 found

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 without > feathers or wings

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 -- https://mail.python.org

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 examp

Re: SimpleHTTPServer and CgiHTTPServer in practice

2017-03-16 Thread Lutz Horn
Some Python users have told me that isn't a good idea, but without any specifics. We don't know *why* those people told you not to use these modules. We also don't know your use case. So it is very hard to advise you. Lutz -- https://mail.python.org/mailman/listinfo/python-list

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 feat

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, for

Re: The ternaery operator

2017-03-16 Thread Gregory Ewing
Stefan Ram wrote: a if c else b Guido has invented something totally new. Why? It's arguably closer to the way you would say such a thing in English. Consider the following sentences: "I wear my red shirt if it's Tuesday, else my green one." "I wear if it's Tuesday my red shirt, else my

Re: The ternaery operator

2017-03-16 Thread Christian Gollwitzer
Am 16.03.17 um 04:12 schrieb Stefan Ram: The syntax a if c else b looks as if Guido made it intentionally ugly so that it will not be used? [...] . But now Guido has invented something totally new. Why? The rationale can be read in PEP 308: https://www.python.org/dev/peps/pep-0308

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: how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-16 Thread Christian Gollwitzer
Am 16.03.17 um 05:40 schrieb Ho Yeung Lee: we have many TV that would like to be monitored, how to embed non-tkinter VLC player into grid of tkinter with python? below code can embeded xterm but not for VLC player import vlc from Tkinter import * import os root = Tk() for r in range(2):