[Tutor] question regarding python exception handling

2005-01-29 Thread Roy
Hello, there: I am learning about python exception handling. I am reading "Python in a Nutshell". In the chapter of exception handling, it says: Note that the try/finally form is distinct from the try/except form: a try statement cannot have both except and finally clauses, as execution order migh

Re: [Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-29 Thread Liam Clarke
Don't get me wrong, underscores have their place, butNotInEveryVariableName. That_was_only_slightly_less_annoying, however. I propose a new syntax - All methods, shall be called Jacques, or a derivative thereof (Jack, Jake etc.) All variables, Claude. Oh, and you could use funny little symbols

Re: [Tutor] carriage return on windows

2005-01-29 Thread Orri Ganel
Jacob S. wrote: Thanks Kent and Max! Wow, I didn't know it did that. I'm too dumb to figure it out on my own I guess... Oh well! I found a cool new thing to play with at least! Thanks, Jacob On Jan 30, 2005, at 02:40, Jacob S. wrote: I don't think that's what he wants. I think he wants to *o

Re: [Tutor] carriage return on windows

2005-01-29 Thread Jacob S.
Thanks Kent and Max! Wow, I didn't know it did that. I'm too dumb to figure it out on my own I guess... Oh well! I found a cool new thing to play with at least! Thanks, Jacob On Jan 30, 2005, at 02:40, Jacob S. wrote: I don't think that's what he wants. I think he wants to *overwrite* what'

Re: [Tutor] carriage return on windows

2005-01-29 Thread Max Noel
On Jan 30, 2005, at 02:40, Jacob S. wrote: I don't think that's what he wants. I think he wants to *overwrite* what's in the shell with new output. For example. so that the whole line is overwritten. In my experience, this is not possible and if anyone can show me how to do it, I would be gratef

Re: [Tutor] carriage return on windows

2005-01-29 Thread Kent Johnson
It seems to work fine in Win2k command shell; try this: >>> import time >>> time.sleep(1) >>> for i in range(9): ... print 'i is', i, '\r', ... time.sleep(1) I get all the output on one line. Kent Jacob S. wrote: I don't think that's what he wants. I think he wants to *overwrite* what's i

Re: [Tutor] carriage return on windows

2005-01-29 Thread Jacob S.
I don't think that's what he wants. I think he wants to *overwrite* what's in the shell with new output. For example. Python 2.4 (#Stuff) ... Percent complete: 50 becomes... Python2.4(#Stuff) ... Percent complete: 51 so that the whole line is overwritten. In my experience, this is not possible

Re: [Tutor] Naming conventions (was: Should this be alist comprehension or something?

2005-01-29 Thread Jacob S.
I just read your post a heck of alot easier than I read Liam's. ;-) Jacob Schmidt iguessthereisnooptionleftexcepttorunwordstogetherwithoutanykindofbreakatall thatshouldannoyeveryoneequally Kent Liam Clarke wrote: Just please_don't_use_underscores. They_make_my_eyes_go_funny_, _and_code_hard_to_rea

Re: [Tutor] Control flow

2005-01-29 Thread Jacob S.
I noticed that too, Liam. b = input("Weather is really bad, still go out to jog? [y/n]") # Would it kill you to have whitespace in a prompt? should really be b = raw_input("Weather is really bad, still go out to jog? [y/n]") to get the effect he wants. input() doesn't only take integers,

Re: [Tutor] carriage return on windows

2005-01-29 Thread Max Noel
On Jan 30, 2005, at 02:18, R. Alan Monroe wrote: print "Percent completed:" + str(percent) + "\r" Print forces a newline. Try sys.stdout.write instead. Alan You can also use the following syntax: >>> print "Percent completed:", str(percent), "\r", The trailing comma is NOT a typo, it is inten

Re: [Tutor] carriage return on windows

2005-01-29 Thread R. Alan Monroe
> print "Percent completed:" + str(percent) + "\r" Print forces a newline. Try sys.stdout.write instead. Alan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] carriage return on windows

2005-01-29 Thread Bill Kranec
Hello, I'm trying to have a loop in a program print a message so I know it's status. Right now I'm using print "Percent completed:" + str(percent) + "\r" Which should send me back to the beginning of the line and overwrite it with a new line. But instead I get: Percent completed: 50 Percent c

Re: [Tutor] range function

2005-01-29 Thread Danny Yoo
On Sat, 29 Jan 2005, Srinivas Iyyer wrote: > I have bunch of coordinates for various vectors. > > small vecs: > > name cord. Xcord. Y Sector no. > smvec175 1001aa > smvec225 50 1aa > smvec3135 1551ab > > large vecs:

[Tutor] range function

2005-01-29 Thread Srinivas Iyyer
Hi: I have bunch of coordinates for various vectors. example: small vecs: name cord. Xcord. Y Sector no. smvec175 1001aa smvec225 50 1aa smvec3135 1551ab large vecs:zone Lvec1 10

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Orri Ganel
Kent Johnson wrote: Bob Gailer wrote: At 04:43 AM 1/29/2005, Liam Clarke wrote: < erk, to the list, to the List!> if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() Anyone else notice

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Kent Johnson
Bob Gailer wrote: At 04:43 AM 1/29/2005, Liam Clarke wrote: < erk, to the list, to the List!> if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() Anyone else notice that he's never gon

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Bob Gailer
At 04:43 AM 1/29/2005, Liam Clarke wrote: < erk, to the list, to the List!> if ( bad_weather =='y' ):    # ask user only if weather is bad.    b = input ( "Weather is really bad, still go out to jog?[y/n]" )    if b == 'y':   go_jogging() Anyone else notice that he's never gonna go jogging if

Re: [Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-29 Thread Kent Johnson
iguessthereisnooptionleftexcepttorunwordstogetherwithoutanykindofbreakatall thatshouldannoyeveryoneequally Kent Liam Clarke wrote: Just please_don't_use_underscores. They_make_my_eyes_go_funny_, _and_code_hard_to_read_in_my_opinion. _u_n_d_e_r_s_c_o_r_e_s_ _a_r_e__u_g_l_y_ I got out of the ha

Re: [Tutor] Diffing two files.

2005-01-29 Thread Kent Johnson
OK, that is clear. diffutils is probably overkill. A simple loop to accumulate the lines of interest should work. Here is some untested (!) code that may do what you want :-) def getCommonPart(filePath): ''' Get a list containing all the lines of a file that fall between the start and end line

Re: [Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-29 Thread Liam Clarke
Just please_don't_use_underscores. They_make_my_eyes_go_funny_, _and_code_hard_to_read_in_my_opinion. _u_n_d_e_r_s_c_o_r_e_s_ _a_r_e__u_g_l_y_ I got out of the habit of using them really fast. Also, __ & _ tend to have special meaning in Python (which is bad enough as it is), so I don't use

Fwd: [Tutor] Control flow

2005-01-29 Thread Liam Clarke
< erk, to the list, to the List!> if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() Anyone else notice that he's never gonna go jogging if the weather is bad? Unless I've got input

Re: [Tutor] Should this be a list comprehension or something?

2005-01-29 Thread Brian van den Broek
Alan Gauld said unto the world upon 2005-01-28 16:28: So you've been looking at Eiffel then? :-) I don't get this joke, but it sounds like the basis for it would be interesting. Can you explain? Bertrand Meyer, the inventor of Eiffel uses rich text to display code in his books. The commercial Ei