Re: [Tutor] Problem by installing Python 3.4.2 64 Bit

2014-10-24 Thread Steven D'Aprano
On Fri, Oct 24, 2014 at 04:31:02PM +0200, Friedhelm Peters wrote: > > Sorry, I'm from Germany and my English isn't so good. By installing python > 3.4.2 (64bit) I get the following error message: > > "There is a problem with this Windows Installer package. A program required > for this install t

[Tutor] How to anticipate and deal with unexpected exceptions (was: Is there a convenient table of Python 3.4 exceptions?)

2014-10-24 Thread Ben Finney
boB Stepp writes: > In the programs I have been dabbling in at work, I am often > "surprised" by the situations my users stumble into that I did not > have sufficient imagination to consider up front. This is a good thing to focus on. Improving the robustness of your code is a matter of experien

Re: [Tutor] Is there a convenient table of Python 3.4 exceptions?

2014-10-24 Thread boB Stepp
On Thu, Oct 23, 2014 at 11:04 PM, Ben Finney wrote: > boB Stepp writes: > [...] > >> I have so far been unable to find a list of these class/subclass >> names. > > The standard library documentation's chapter on exceptions > https://docs.python.org/3/library/exceptions.html> shows > https://docs.

Re: [Tutor] Is there a convenient table of Python 3.4 exceptions?

2014-10-24 Thread boB Stepp
On Thu, Oct 23, 2014 at 10:57 PM, Danny Yoo wrote: > > > I have so far been unable to find a list of these class/subclass names. Of > > course I can force an error to occur in the interpreter and see what comes > > up for each type of error I wish to catch. Is there such a table or list? > > > > H

Re: [Tutor] Code critique

2014-10-24 Thread Bo Morris
Thank you all for the helpful criticism. I wish I was able to catch on to what you are suggesting more quickly. Based on your recommendations, I have come up with the following so far, however I just dont see it as easily as I did while using the if/elif statements. This is what I have so far. I

Re: [Tutor] Is there a convenient table of Python 3.4 exceptions?

2014-10-24 Thread Cameron Simpson
On 24Oct2014 15:50, Ben Finney wrote: Is this a hurdle for newcomers? Yes, and that's why the standard library API documentation is not a tutorial. We have separate tutorial documentation for that. It's not a problem with the documentation of ‘signal.getsignal’ that it doesn't have an exhaustiv

Re: [Tutor] Code critique

2014-10-24 Thread Japhy Bartlett
out = stdout.read() if '3102EHD-Lanka-1108' in out: s.exec_command('export DISPLAY=:0.0; cd /Downloads/Hourly/win.sh') sftp = s.open_sftp() sftp.get('/Downloads/Hourly/3102EHD-01108/3102EHD-01108.png', '/Downloads/Hourly/3102EHD-01108.png') sftp.close() print

Re: [Tutor] Standard Library Performance (3.4.1)

2014-10-24 Thread Adam Jensen
On 10/24/2014 08:01 AM, Stefan Behnel wrote: > Alan Gauld schrieb am 24.10.2014 um 13:03: >> Not all library modules are C based however so it doesn't >> always apply. But they are usually optimised and thoroughly >> debugged so it is still worth using them rather than building >> your own. > > I

Re: [Tutor] Code critique

2014-10-24 Thread Peter Otten
Bo Morris wrote: > "...Regarding your program, instead of writing long sequences of > repetitive if > conditions, I would write one function for each of the different > operations and store them in a dict, mapping each host name to a function > (and multiple host names may map to the same function

Re: [Tutor] Code critique

2014-10-24 Thread Bo Morris
"...Regarding your program, instead of writing long sequences of repetitive if conditions, I would write one function for each of the different operations and store them in a dict, mapping each host name to a function (and multiple host names may map to the same function). Then, look up the host na

[Tutor] Problem by installing Python 3.4.2 64 Bit

2014-10-24 Thread Friedhelm Peters
Dear Mr. and Mrs., Sorry, I'm from Germany and my English isn't so good. By installing python 3.4.2 (64bit) I get the following error message: "There is a problem with this Windows Installer package. A program required for this install the complete could not be run. Contact your support p

Re: [Tutor] Code critique

2014-10-24 Thread Stefan Behnel
Bo Morris schrieb am 24.10.2014 um 14:03: > May I please get a little instructional criticism. The code below works. It > logs into 9 different Linux computers, runs a couple commands, and then > transfers a file back to the server. I want to become a better Python > coder; therefore, I was hoping

[Tutor] Code critique

2014-10-24 Thread Bo Morris
Hello all, May I please get a little instructional criticism. The code below works. It logs into 9 different Linux computers, runs a couple commands, and then transfers a file back to the server. I want to become a better Python coder; therefore, I was hoping for some ways to make the below code b

Re: [Tutor] Standard Library Performance (3.4.1)

2014-10-24 Thread Stefan Behnel
Alan Gauld schrieb am 24.10.2014 um 13:03: > Not all library modules are C based however so it doesn't > always apply. But they are usually optimised and thoroughly > debugged so it is still worth using them rather than building > your own. It's worth stressing this point a bit more. Lots of peopl

Re: [Tutor] Standard Library Performance (3.4.1)

2014-10-24 Thread Alan Gauld
On 24/10/14 02:45, Adam Jensen wrote: I'm tinkering this evening and I've noticed that math.factorial() is much faster than my plain python implementations. Is this kind of performance difference typical of the standard library functions (compared to plain python user implementations)? Yes,

[Tutor] Standard Library Performance (3.4.1)

2014-10-24 Thread Adam Jensen
I'm tinkering this evening and I've noticed that math.factorial() is much faster than my plain python implementations. import math def factorial(n): temp = 1 for k in range(0,n): temp = temp * (n - k) return(temp) def fac(n): r