Python3 http.server.SimpleHTTPRequestHandler static files

2016-03-02 Thread Tal Bar-Or
Hello All, I need to create simple web server i am using following http.server.SimpleHTTPRequestHandler The class along with the web content is as follows structure main folder | |_httplocal https://mail.python.org/mailman/listinfo/python-list

Re: Everything good about Python except GUI IDE?

2016-03-02 Thread Mike S via Python-list
On 2/27/2016 10:13 AM, wrong.addres...@gmail.com wrote: On Saturday, 27 February 2016 18:08:36 UTC+2, Dietmar Schwertberger wrote: On 27.02.2016 12:18, wrong.addres...@gmail.com wrote: Isn't there any good GUI IDE like Visual Basic? I hope there are some less well known GUI IDEs which I did n

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-02 Thread Anders Wegge Keller
On Mon, 29 Feb 2016 23:29:43 + Mark Lawrence wrote: > On 29/02/2016 22:40, Larry Martell wrote: >> I think for the most part, the mental health industry is most >> interested in pushing drugs and forcing people into some status quo. > I am disgusted by your comments. I'll keep my original

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-02 Thread Ian Kelly
On Mar 2, 2016 9:01 PM, "Rustom Mody" wrote: > > On Thursday, March 3, 2016 at 7:59:13 AM UTC+5:30, Steven D'Aprano wrote: > > On Thu, 3 Mar 2016 04:02 am, Rustom Mody wrote: > > > > > And how is [1]'s starting different from Kenneth's finding his weight > > > to be the weight of the universe? > >

Re: Inception

2016-03-02 Thread Paul Rubin
Ben Finney writes: > I'm familiar with that document. It doesn't help me understand what you > mean by “embed CPython in CPython”. It seems straightforward enough to me. Lots of Python programs load C extensions. Denis is asking whether one of those C extensions could itself embed CPython throu

Re: Inception

2016-03-02 Thread Rustom Mody
On Thursday, March 3, 2016 at 11:13:58 AM UTC+5:30, Denis Akhiyarov wrote: > Embed using C-API from ctypes, cffi or cython, but not using subprocesses. > Thanks for asking! > > Here is link to official documentation about embedding: > > https://docs.python.org/3.6/extending/index.html Nowadays

Re: Inception

2016-03-02 Thread Ben Finney
Denis Akhiyarov writes: > Embed using C-API from ctypes, cffi or cython, but not using > subprocesses. Thanks for asking! I'm glad you appreciate my asking, but I am no closer to an answer. What would meet your requirements, what would be a “yes” for you? > Here is link to official documentatio

Re: Inception

2016-03-02 Thread Denis Akhiyarov
Embed using C-API from ctypes, cffi or cython, but not using subprocesses. Thanks for asking! Here is link to official documentation about embedding: https://docs.python.org/3.6/extending/index.html -- https://mail.python.org/mailman/listinfo/python-list

Re: Inception

2016-03-02 Thread Ben Finney
Ben Finney writes: > Denis Akhiyarov writes: > > > Is it possible to embed CPython in CPython, e.g. using ctypes, cffi, > > or cython? > > I don't know what you mean by “embed” in this context. What would > qualify as “yes” for you? Here is CPython embedded in CPython:: >>> import subproce

Re: Inception

2016-03-02 Thread Ben Finney
Denis Akhiyarov writes: > Is it possible to embed CPython in CPython, e.g. using ctypes, cffi, > or cython? I don't know what you mean by “embed” in this context. What would qualify as “yes” for you? -- \“You don't change the world by placidly finding your bliss — | `\you do

Inception

2016-03-02 Thread Denis Akhiyarov
Is it possible to embed CPython in CPython, e.g. using ctypes, cffi, or cython? -- https://mail.python.org/mailman/listinfo/python-list

Re: Correct IDLE usage (was Reason for not allowing import twice but allowing reload())

2016-03-02 Thread Rustom Mody
On Thursday, March 3, 2016 at 9:38:11 AM UTC+5:30, Rustom Mody wrote: > On Thursday, March 3, 2016 at 8:11:20 AM UTC+5:30, Terry Reedy wrote: > > On 3/2/2016 10:22 AM, Rustom Mody wrote: > > > On Tuesday, March 1, 2016 at 12:23:02 PM UTC+5:30, Terry Reedy wrote: > > >> On 2/29/2016 7:42 AM, Rustom

Re: Correct IDLE usage (was Reason for not allowing import twice but allowing reload())

2016-03-02 Thread Rustom Mody
On Thursday, March 3, 2016 at 8:11:20 AM UTC+5:30, Terry Reedy wrote: > On 3/2/2016 10:22 AM, Rustom Mody wrote: > > On Tuesday, March 1, 2016 at 12:23:02 PM UTC+5:30, Terry Reedy wrote: > >> On 2/29/2016 7:42 AM, Rustom Mody wrote: > >> > >>> Is import needed at all when trying out in Idle? > >> .

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-02 Thread Rustom Mody
On Thursday, March 3, 2016 at 7:59:13 AM UTC+5:30, Steven D'Aprano wrote: > On Thu, 3 Mar 2016 04:02 am, Rustom Mody wrote: > > > And how is [1]'s starting different from Kenneth's finding his weight > > to be the weight of the universe? > > Is that a trick question? > > "How is a raven like a

Re: Continuing indentation

2016-03-02 Thread Tim Chase
On 2016-03-03 08:29, Ben Finney wrote: > Skip Montanaro writes: >> Running flake8 over some code which has if statements with >> multiple conditions like this: >> >> if (some_condition and >> some_other_condition and >> some_final_condition): >> play_bingo() > > For th

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 06:33 PM, Chris Angelico wrote: It's not just name collisions. You should be able to keep in your head every local name in a section of code. Giving a name to a single-use expression wastes one of those precious slots in your mind, even if it's easily and safely unique. If it's a

Re: Correct IDLE usage (was Reason for not allowing import twice but allowing reload())

2016-03-02 Thread Terry Reedy
On 3/2/2016 10:22 AM, Rustom Mody wrote: On Tuesday, March 1, 2016 at 12:23:02 PM UTC+5:30, Terry Reedy wrote: On 2/29/2016 7:42 AM, Rustom Mody wrote: Is import needed at all when trying out in Idle? ... So it does appear that 1. import not necessary with(in) idle 2. However import and f5 (

Re: How to know if an object is still be referenced?

2016-03-02 Thread jfong
sohca...@gmail.com at 2016/3/3 UTC+8 7:38:45AM wrote: > "label" might be a local variable, but it's constructor includes a reference > to the frame in which it is going. The frame object will create a reference > to the newly-created Label object. At that point, there will be two > references

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 1:27 PM, Steven D'Aprano wrote: > We can be absolutely certain that Kenneth weighs less than the entire > universe. We don't even need a set of scales. Formal proof: 1) No physical object can have negative mass. 2) I am a part of the universe and have positive mass. 3) I a

Re: Continuing indentation

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 1:30 PM, Ben Finney wrote: > If your functions are so long that you fear using a specific name will > deter you from using it again *in the same scope*, then the name isn't > descriptive and a better one should be chosen, or the function is too > large and should be broken i

Re: Continuing indentation

2016-03-02 Thread Ben Finney
Steven D'Aprano writes: > If you only use "continue_playing" in exactly one place, then it > doesn't deserve a name. I disagree. If it's complex, then it may still deserve a name. > > Names are important! > > Too important to waste on every single-use expression. To waste on *every* single-use

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 04:02 am, Rustom Mody wrote: > And how is [1]'s starting different from Kenneth's finding his weight > to be the weight of the universe? Is that a trick question? "How is a raven like a writing desk?" "Neither of them are made of cheese cake." We can be absolutely certain t

Re: Continuing indentation

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 11:02 am, Carl Meyer wrote: > On 03/02/2016 04:54 PM, Chris Angelico wrote: >> On Thu, Mar 3, 2016 at 10:46 AM, wrote: >>> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: if (some_condition and some_other_condition and

Re: Continuing indentation

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 09:10 am, Marko Rauhamaa wrote: > Ethan Furman : > >> No, it isn't. Using '\' for line continuation is strongly discouraged. > > Why would you discourage valid syntax? Because it is error-prone and ugly. This is valid syntax too. Do you write your code like this? x

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 08:49 am, Mark Lawrence wrote: > On 02/03/2016 17:23, Steven D'Aprano wrote: >> On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: >> >>> What is missing is the rules that are obeyed by the "is" operator. >> >> I think what is actually missing is some common bloody sense. The Py

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 05:12 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> In this case, "same object" carries the normal English meaning of >> "same" and the normal computer science meaning of "object" in the >> sense of "Object Oriented Programming". There's no mystery here, no >> circular def

Re: Explaining names vs variables in Python

2016-03-02 Thread Rustom Mody
On Thursday, March 3, 2016 at 3:22:42 AM UTC+5:30, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 8:49 AM, Mark Lawrence wrote: > > Are we discussing UK (highly generalised), Geordie, Glaswegian, US, > > Canadian, South African, Australian, New Zealand, or some other form of > > English? > > Is t

Re: Continuing indentation

2016-03-02 Thread Ben Finney
(Igor, your “From” field doesn't contain a name for you. Can you put your name, e.g. “Igor Whateverisyoursurname”, in the “From” field?) codewiz...@gmail.com writes: > How about: > > continue_playing = ( > some_condition and > some_other_condition and > some_final_condition >

Re: Continuing indentation

2016-03-02 Thread Pete Forman
Chris Angelico writes: > On Thu, Mar 3, 2016 at 10:46 AM, wrote: >> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >>> >>> if (some_condition and >>> some_other_condition and >>> some_final_condition): >>> play_bingo() >> >> How about: >> >>

Re: Continuing indentation

2016-03-02 Thread Carl Meyer
On 03/02/2016 04:54 PM, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 10:46 AM, wrote: >> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >>> >>> if (some_condition and >>> some_other_condition and >>> some_final_condition): >>> play_bingo() >>

Re: Continuing indentation

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 10:46 AM, wrote: > On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >> >> if (some_condition and >> some_other_condition and >> some_final_condition): >> play_bingo() > > How about: > > continue_playing = ( > some_co

Re: Continuing indentation

2016-03-02 Thread codewizard
On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() How about: continue_playing = ( some_condition and some_other_condition and some_fi

Re: Continuing indentation

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 9:10 AM, Marko Rauhamaa wrote: > Ethan Furman : > >> No, it isn't. Using '\' for line continuation is strongly discouraged. > > Why would you discourage valid syntax? > Isn't that exactly the point of style guides? They stipulate/encourage a particular subset of valid synt

Re: How to know if an object is still be referenced?

2016-03-02 Thread sohcahtoa82
On Wednesday, March 2, 2016 at 3:35:32 AM UTC-8, jf...@ms4.hinet.net wrote: > Terry Reedy at 2016/3/2 UTC+8 3:04:10PM wrote: > > On 3/1/2016 9:35 PM, jf...@ms4.hinet.net wrote: > > > Recently I was puzzled by a tkinter problem. The codes below (from a > > > book) can display the picture correctly

tkFileDialog Question

2016-03-02 Thread Wildman via Python-list
Is there a way to prevent the dialog from displaying hidden directories? My research has not found anything relating to hidden files or directories. -- GNU/Linux user #557453 "Philosophy is common sense with big words." -James Madison -- https://mail.python.org/mailman/listinfo/python-list

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 02:44 PM, Skip Montanaro wrote: I don't know. Maybe I need to ask the flake8 author about his rationale for this message. It seems to me from my experience with the language that this particular message is going against pretty common practice. Does vim's Python mode exhibit similar

Re: Explaining names vs variables in Python

2016-03-02 Thread Mark Lawrence
On 02/03/2016 21:52, Chris Angelico wrote: On Thu, Mar 3, 2016 at 8:49 AM, Mark Lawrence wrote: Are we discussing UK (highly generalised), Geordie, Glaswegian, US, Canadian, South African, Australian, New Zealand, or some other form of English? Is there any disagreement among them about the w

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 02:10 PM, Marko Rauhamaa wrote: Ethan Furman : No, it isn't. Using '\' for line continuation is strongly discouraged. Why would you discourage valid syntax? 1) It's ugly 2) Any non-newline whitespace after the '\' and you don't have line continuation any more, and no visib

Re: Continuing indentation

2016-03-02 Thread Skip Montanaro
Thanks for the replies, folks. I'll provide a single response: 1. Using backslash to continue... When I first started using Python in the mid-90s I don't recall that parenthesized expressions could be continued across lines (at least, not in all contexts), so the backslash was required. I believe

Re: Everything good about Python except GUI IDE?

2016-03-02 Thread Marko Rauhamaa
Christian Gollwitzer : > Have a look at PowerShell. It's not Python, and it is from MS - but it > works along those lines, passing .NET objects through the pipe. Owing > to that, instead of $2=="something" in the awk progra, you can address > the field(attribute) $2 by the correct name instead of

Re: looking into python...

2016-03-02 Thread Ben Finney
crankypuss writes: > "Python code can be packaged into stand-alone executable programs for > some of the most popular operating systems, allowing the distribution of > Python-based software for use on those environments without requiring > the installation of a Python interpreter." (wikipedia)

Re: Continuing indentation

2016-03-02 Thread Marko Rauhamaa
Ethan Furman : > No, it isn't. Using '\' for line continuation is strongly discouraged. Why would you discourage valid syntax? Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Speaking of Javascript [was Re: Everything good about Python except GUI IDE?]

2016-03-02 Thread Jon Ribbens
On 2016-03-02, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 5:29 AM, Jon Ribbens > wrote: >> On 2016-03-02, Chris Angelico wrote: >>> You're no more vulnerable looking at one of those listings >>> than you would be going to a web site entirely controlled by the >>> attacker, save that (particul

Re: Everything good about Python except GUI IDE?

2016-03-02 Thread Christian Gollwitzer
Am 02.03.16 um 09:20 schrieb Marko Rauhamaa: Chris Angelico : On Wed, Mar 2, 2016 at 4:41 PM, Marko Rauhamaa wrote: I was talking about JSON for the standard I/O, not the command-line arguments, as in: ps -ef | awk '/httpd/ { print $2 }' where "ps -ef" emits SPC-separated fields and LF-

looking into python...

2016-03-02 Thread crankypuss
"Python code can be packaged into stand-alone executable programs for some of the most popular operating systems, allowing the distribution of Python-based software for use on those environments without requiring the installation of a Python interpreter." (wikipedia) How correct is that? Which

Re: Continuing indentation

2016-03-02 Thread Ethan Furman
On 03/02/2016 12:50 PM, Marko Rauhamaa wrote: Skip Montanaro queried: Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() [...] is there a

Re: Explaining names vs variables in Python

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 8:49 AM, Mark Lawrence wrote: > Are we discussing UK (highly generalised), Geordie, Glaswegian, US, > Canadian, South African, Australian, New Zealand, or some other form of > English? Is there any disagreement among them about the word "same"? ChrisA -- https://mail.pyth

Re: Explaining names vs variables in Python

2016-03-02 Thread Mark Lawrence
On 02/03/2016 17:23, Steven D'Aprano wrote: On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: What is missing is the rules that are obeyed by the "is" operator. I think what is actually missing is some common bloody sense. The Python docs are written in English, and don't define *hundreds*,

Re: Continuing indentation

2016-03-02 Thread Ben Finney
Skip Montanaro writes: > Running flake8 over some code which has if statements with multiple > conditions like this: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() > > the tool complains that the indentation of the conditi

Re: Continuing indentation

2016-03-02 Thread Peter Otten
Skip Montanaro wrote: > Running flake8 over some code which has if statements with multiple > conditions like this: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() > > the tool complains that the indentation of the conditi

Re: Continuing indentation

2016-03-02 Thread Wolfgang Maier
On 3/2/2016 21:43, Skip Montanaro wrote: Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() the tool complains that the indentation of the c

Re: Speaking of Javascript [was Re: Everything good about Python except GUI IDE?]

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 5:29 AM, Jon Ribbens wrote: > On 2016-03-02, Chris Angelico wrote: >> To be fair, this isn't a JS exploit; it's a trusting-of-trust issue - >> eBay has declared that you can trust them to sanitize their sellers' >> listings, and so you trust eBay, but this exploit gets past

Re: Continuing indentation

2016-03-02 Thread Marko Rauhamaa
Skip Montanaro : > Running flake8 over some code which has if statements with multiple > conditions like this: > > if (some_condition and > some_other_condition and > some_final_condition): > play_bingo() > [...] > > is there a better way to break lines I'm missing whic

Continuing indentation

2016-03-02 Thread Skip Montanaro
Running flake8 over some code which has if statements with multiple conditions like this: if (some_condition and some_other_condition and some_final_condition): play_bingo() the tool complains that the indentation of the conditions is the same as the next block. In th

Re: Speaking of Javascript [was Re: Everything good about Python except GUI IDE?]

2016-03-02 Thread Jon Ribbens
On 2016-03-02, Chris Angelico wrote: > To be fair, this isn't a JS exploit; it's a trusting-of-trust issue - > eBay has declared that you can trust them to sanitize their sellers' > listings, and so you trust eBay, but this exploit gets past the > filter. This is true. It sounds like their filter

Re: What arguments are passed to the __new__ method ?

2016-03-02 Thread Ian Kelly
On Wed, Mar 2, 2016 at 10:57 AM, Rob Gaddi wrote: > Peter Pearson wrote: > >> On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote: >>> >>> It's not clear to me what arguments are passed to the >>> __new__ method. Here is a piece of code: >>> >>> >>> class Premiere: >>> >>> def __new__(cls, price): >>

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Steven D'Aprano : > In this case, "same object" carries the normal English meaning of > "same" and the normal computer science meaning of "object" in the > sense of "Object Oriented Programming". There's no mystery here, no > circular definition. I see three possible ways of defining "is" / objec

Re: What arguments are passed to the __new__ method ?

2016-03-02 Thread Rob Gaddi
Peter Pearson wrote: > On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote: >> >> It's not clear to me what arguments are passed to the >> __new__ method. Here is a piece of code: >> >> >> class Premiere: >> >> def __new__(cls, price): >> return object.__new__(cls) >> >> def __init__(sel

Re: Explaining names vs variables in Python

2016-03-02 Thread Ben Finney
Salvatore DI DIO writes: > I know Python does not have variables, but names. In addition to the other food answers in this thread, you will want to watch http://nedbatchelder.com/text/names.html> Ned Batchelder's presentation on “Facts and myths about Python names and values”. -- \“Me

Re: Speaking of Javascript [was Re: Everything good about Python except GUI IDE?]

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 4:05 AM, Steven D'Aprano wrote: > Speaking of Javascript exploits: > > http://thedailywtf.com/articles/bidding-on-security > > > This is a real exploit, and Ebay have refused to fix it. Yay them! > > More here: > > http://blog.checkpoint.com/2016/02/02/ebay-platform-exposed-

Re: What arguments are passed to the __new__ method ?

2016-03-02 Thread Peter Pearson
On Tue, 1 Mar 2016 18:24:12 +0100, ast wrote: > > It's not clear to me what arguments are passed to the > __new__ method. Here is a piece of code: > > > class Premiere: > > def __new__(cls, price): > return object.__new__(cls) > > def __init__(self, price): > pass [snip

Re: Explaining names vs variables in Python

2016-03-02 Thread Rustom Mody
On Wednesday, March 2, 2016 at 10:53:40 PM UTC+5:30, Steven D'Aprano wrote: > On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: > > > What is missing is the rules that are obeyed by the "is" operator. > > I think what is actually missing is some common bloody sense. The Python > docs are written

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 01:11 am, Marko Rauhamaa wrote: > What is missing is the rules that are obeyed by the "is" operator. I think what is actually missing is some common bloody sense. The Python docs are written in English, and don't define *hundreds*, possible *thousands* of words because they are

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Thu, 3 Mar 2016 12:48 am, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> Python defines that every object has an identity, which can be >>> represented as an integer. Since this is an intrinsic part of the >>> object, no two distinct o

Speaking of Javascript [was Re: Everything good about Python except GUI IDE?]

2016-03-02 Thread Steven D'Aprano
Speaking of Javascript exploits: http://thedailywtf.com/articles/bidding-on-security This is a real exploit, and Ebay have refused to fix it. Yay them! More here: http://blog.checkpoint.com/2016/02/02/ebay-platform-exposed-to-severe-vulnerability/ -- Steven -- https://mail.python.org/mail

Re: [Off-topic] Requests author discusses MentalHealthError exception

2016-03-02 Thread Rustom Mody
On Tuesday, March 1, 2016 at 10:36:02 PM UTC+5:30, Steven D'Aprano wrote: > On Tue, 1 Mar 2016 04:08 am, Rustom Mody wrote: > > > And who is the last arbiter on that 'reality'? > > I'll give you the benefit of the doubt that this is a genuine question, and > not just an attempt to ask a rhetorica

Re: rdflib subclass problem

2016-03-02 Thread duncan smith
On 02/03/16 08:16, dieter wrote: > duncan smith writes: > >> I'm just getting to grips with RDF and rdflib, and I've hit >> something I can't figure out. >> >> I have a graph with information on two people. (I haven't shown the >> imports below because they're scattered around my interactiv

Re: urlopen, six, and py2

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 2:36 AM, Fabien wrote: > On 03/02/2016 03:35 PM, Matt Wheeler wrote: >> >> I agree that six should probably handle this, > > > Thank you Matt and Chris for your answers. Do you think I should open an > issue on six? It sounds unlikely that I am the first one having this > pr

Re: urlopen, six, and py2

2016-03-02 Thread Fabien
On 03/02/2016 03:35 PM, Matt Wheeler wrote: I agree that six should probably handle this, Thank you Matt and Chris for your answers. Do you think I should open an issue on six? It sounds unlikely that I am the first one having this problem... (until this difference with urlopen I have found

Re: Explaining names vs variables in Python

2016-03-02 Thread Jussi Piitulainen
Ian Kelly writes: > On Wed, Mar 2, 2016 at 2:35 AM, Jussi Piitulainen wrote: >> The following are too delicate for me. I suppose the answers could have >> been different, but I can't guess what mechanism actually leads to these >> results. Just idle curiosity on my part. >> > 890 is 890 >> Tru

Re: Correct IDLE usage (was Reason for not allowing import twice but allowing reload())

2016-03-02 Thread Rustom Mody
On Tuesday, March 1, 2016 at 12:23:02 PM UTC+5:30, Terry Reedy wrote: > On 2/29/2016 7:42 AM, Rustom Mody wrote: > > > Is import needed at all when trying out in Idle? > ... > > So it does appear that > > 1. import not necessary with(in) idle > > 2. However import and f5 (ie is run as main) are di

Re: Reason for not allowing import twice but allowing reload()

2016-03-02 Thread Grant Edwards
On 2016-03-02, Ian Kelly wrote: > Software updates? The nice thing about *nix systems is that *most* > updates don't require a reboot. I'm still going to reboot any time > there's a kernel update though, and those are fairly frequent. I could > read the patch notes to determine whether this new k

Re: Explaining names vs variables in Python

2016-03-02 Thread Ian Kelly
On Wed, Mar 2, 2016 at 2:35 AM, Jussi Piitulainen wrote: > The following are too delicate for me. I suppose the answers could have > been different, but I can't guess what mechanism actually leads to these > results. Just idle curiosity on my part. > 890 is 890 > True id(890) == id(890)

Re: Explaining names vs variables in Python

2016-03-02 Thread Rustom Mody
On Wednesday, March 2, 2016 at 7:42:09 PM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico : > > > On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: > >> Chris Angelico : > >> > >>> Python defines that every object has an identity, which can be > >>> represented as an integer. Since this is

Re: urlopen, six, and py2

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 1:35 AM, Matt Wheeler wrote: >> from six.moves.urllib.request import urlopen >> >> try: >> with urlopen('http://www.google.com') as resp: >> _ = resp.read() >> except AttributeError: >> # python 2 >> resp = urlopen('http://www.google.com') >> _ = resp

Re: urlopen, six, and py2

2016-03-02 Thread Matt Wheeler
On 2 March 2016 at 14:05, Fabien wrote: > [snip] > My question is: why does the python3 version need a "with" block while the > python2 version doesn't? Can I skip the "with" entirely, or should I rather > do the following: It's not a case of "need", using the "with" construction is an added feat

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Chris Angelico : > On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> Python defines that every object has an identity, which can be >>> represented as an integer. Since this is an intrinsic part of the >>> object, no two distinct objects can truly have identical >>

urlopen, six, and py2

2016-03-02 Thread Fabien
Hi, it seems that urlopen had no context manager for versions < 3. The following code therefore will crash on py2 but not on py3. from six.moves.urllib.request import urlopen with urlopen('http://www.google.com') as resp: _ = resp.read() Error: AttributeError: addinfourl instance has no a

Re: Explaining names vs variables in Python

2016-03-02 Thread Chris Angelico
On Thu, Mar 3, 2016 at 12:39 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Python defines that every object has an identity, which can be >> represented as an integer. Since this is an intrinsic part of the >> object, no two distinct objects can truly have identical >> characteristics. Python'

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Chris Angelico : > Python defines that every object has an identity, which can be > represented as an integer. Since this is an intrinsic part of the > object, no two distinct objects can truly have identical > characteristics. Python's objects are like rifles - there are many > like it, but this

Re: Explaining names vs variables in Python

2016-03-02 Thread Jussi Piitulainen
Chris Angelico writes: > Python defines that every object has an identity, which can be > represented as an integer. Since this is an intrinsic part of the > object, no two distinct objects can truly have identical > characteristics. Python's objects are like rifles - there are many > like it, bu

Re: Explaining names vs variables in Python

2016-03-02 Thread Chris Angelico
On Wed, Mar 2, 2016 at 11:34 PM, Marko Rauhamaa wrote: > The ontological question is, can two *distinct* objects with *identical* > characteristics exist? > > The fermionic answer is, no. > > The bosonic answer is, sure. > > Set theory has fermionic ontology (it's called extensionality). > > Pytho

Re: Explaining names vs variables in Python

2016-03-02 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 2 Mar 2016 08:03 pm, Jesper K Brogaard wrote: > >> As I understand it, when you use 'is', you are comparing addresses to >> objects, not the values contained in the objects. Use '==' instead. > > You should not think about addresses, because the location of objects > is

Re: Everything good about Python except GUI IDE?

2016-03-02 Thread Marko Rauhamaa
Gordon Levi : > I find it difficult to believe that you _love_ updating your contacts > using Emacs even if it gives you an excuse to get some therapy from > Eliza. It seems equally unlikely that you can do without phone numbers > and addresses for your contacts. WP8 doesn't allow me to modify th

Re: How to know if an object is still be referenced?

2016-03-02 Thread jfong
Terry Reedy at 2016/3/2 UTC+8 3:04:10PM wrote: > On 3/1/2016 9:35 PM, jf...@ms4.hinet.net wrote: > > Recently I was puzzled by a tkinter problem. The codes below (from a book) > > can display the picture correctly. > > > > gifdir = "../gifs/" > > from tkinter import * > > win = Tk(

Re: What arguments are passed to the __new__ method ?

2016-03-02 Thread Steven D'Aprano
On Wed, 2 Mar 2016 08:23 pm, ast wrote: > An other question: > > What is the very first method launched when an instantiation is done ? > e.g obj = MyClass(0, 5, 'xyz') > > is it __call__ (from object or MyClass if overriden) ? No, not object or MyClass. The *metaclass* __call__ is called. F

Re: Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Thank you very much ast and all of you. I better understant now Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: Explaining names vs variables in Python

2016-03-02 Thread ast
"Salvatore DI DIO" a écrit dans le message de news:a894d5ed-d906-4ff7-a537-32bf0187e...@googlegroups.com... It is a little difficult to explain this behavior to a newcommer in Python Can someone give me the right argument to expose ? It is explained with many details here: http://blog.ler

Explaining names vs variables in Python (follow)

2016-03-02 Thread Salvatore DI DIO
Thank you very much all of you. I better understand now Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Wed, 2 Mar 2016 08:03 pm, Jesper K Brogaard wrote: > As I understand it, when you use 'is', you are comparing addresses to > objects, not the values contained in the objects. Use '==' instead. You should not think about addresses, because the location of objects is not part of the language. It

Re: Reason for not allowing import twice but allowing reload()

2016-03-02 Thread Rustom Mody
On Wednesday, March 2, 2016 at 3:45:28 PM UTC+5:30, Rustom Mody wrote: > On Wednesday, March 2, 2016 at 7:53:10 AM UTC+5:30, Ian wrote: > > On Tue, Mar 1, 2016 at 6:19 PM, Steven D'Aprano wrote: > > > On Wed, 2 Mar 2016 09:29 am, Ian Kelly wrote: > > > > > >> There's a big difference between > > >>

Re: Explaining names vs variables in Python

2016-03-02 Thread Steven D'Aprano
On Wed, 2 Mar 2016 07:32 pm, Salvatore DI DIO wrote: > Hello, > > I know Python does not have variables, but names. > Multiple names cant then be bound to the same objects. Multiple names CAN be bound to the same object: py> x = y = [] py> x is y True py> z = x py> y.append("Hello world!") py>

Re: Reason for not allowing import twice but allowing reload()

2016-03-02 Thread Rustom Mody
On Wednesday, March 2, 2016 at 7:53:10 AM UTC+5:30, Ian wrote: > On Tue, Mar 1, 2016 at 6:19 PM, Steven D'Aprano wrote: > > On Wed, 2 Mar 2016 09:29 am, Ian Kelly wrote: > > > >> There's a big difference between > >> that and clocking a year of uptime just because you can, though. > > > > What othe

Re: Everything good about Python except GUI IDE?

2016-03-02 Thread Gordon Levi
Marko Rauhamaa wrote: >Gordon Levi : > >> Nobody likes filling in forms but how do you suggest converting a form >> based app into something loveable. > >Straight HTML does forms just fine without CSS or JavaScript, yet few >can resist. > >> What interface would make you love adding a new contact

Re: Explaining names vs variables in Python

2016-03-02 Thread Jussi Piitulainen
Salvatore DI DIO writes: [- -] > But where is the consistency ? if I try : > v = 890 w = 890 v is w > False I think it goes as follows. Python keeps a cached pool of some numbers that may occur relatively often. When a numerical expression evaluates to a cached value, it returns

Re: What arguments are passed to the __new__ method ?

2016-03-02 Thread ast
"ast" a écrit dans le message de news:56d5d043$0$632$426a7...@news.free.fr... ty for the détailed explanations. An other question: What is the very first method launched when an instantiation is done ? e.g obj = MyClass(0, 5, 'xyz') is it __call__ (from object or MyClass if overriden) ?

Effects of caching frequently used objects, was Re: Explaining names vs variables in Python

2016-03-02 Thread Peter Otten
Salvatore DI DIO wrote: > Hello, > > I know Python does not have variables, but names. > Multiple names cant then be bound to the same objects. > > So this behavior > b = 234 v = 234 b is v > True > > according to the above that is ok > > > > But where is the consistency ? if

Re: Explaining names vs variables in Python

2016-03-02 Thread Antoon Pardon
On 02/03/2016 09:32, Salvatore DI DIO wrote: > Hello, > > I know Python does not have variables, but names. > Multiple names cant then be bound to the same objects. > > So this behavior Python has variables. They are just not the kind of variables you find in C and variations but more like variab

Re: Explaining names vs variables in Python

2016-03-02 Thread Jesper K Brogaard
Den 02-03-2016 kl. 09:32 skrev Salvatore DI DIO: Hello, I know Python does not have variables, but names. Multiple names cant then be bound to the same objects. So this behavior b = 234 v = 234 b is v True according to the above that is ok But where is the consistency ? if I try : v =

Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Hello, I know Python does not have variables, but names. Multiple names cant then be bound to the same objects. So this behavior >>> b = 234 >>> v = 234 >>> b is v True according to the above that is ok But where is the consistency ? if I try : >>> v = 890 >>> w = 890 >>> v is w False It

  1   2   >