Re: "Temporary" Variable

2006-02-25 Thread Terry Hancock
On 24 Feb 2006 14:08:22 -0800 [EMAIL PROTECTED] wrote: > Reply to all: I realize that naming a variable "spam" is > not entirely kosherized. In fact this is untrue: It is an official rule straight from the BDFL himself that example programs should contain words like "spam", "ham", "eggs" from the

Re: "Temporary" Variable

2006-02-25 Thread Steven D'Aprano
On Fri, 24 Feb 2006 14:08:22 -0800, darthbob88 wrote: > Reply to all: I realize that naming a variable "spam" is not entirely > kosherized. It was originally named secret, but I renamed it in a fit > of whimsy. The language is named after Monty Python's Flying Circus, is > it not? Remember the Spa

Re: "Temporary" Variable

2006-02-24 Thread darthbob88
Reply to all: I realize that naming a variable "spam" is not entirely kosherized. It was originally named secret, but I renamed it in a fit of whimsy. The language is named after Monty Python's Flying Circus, is it not? Remember the Spam Sketch. http://en.wikipedia.org/wiki/Spam_sketch I thank you

Re: "Temporary" Variable

2006-02-24 Thread Jeffrey Schwab
Steven D'Aprano wrote: > On Fri, 24 Feb 2006 00:24:25 +, Jeffrey Schwab wrote: > > >>Steven D'Aprano wrote: >> >>>On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: >>> >>>My comments inserted inline. >>> >>> >>> >>> #!/usr/bin/python #simple guessing game, with numbers import

Re: "Temporary" Variable

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 01:50:40 -0800, bonono wrote: > Steven D'Aprano wrote: >> Just out of curiosity, when do you think is the right time to begin >> teaching programmers good practice from bad? Before or after they've >> learnt bad habits? > > When you have authority over the coding guideline.

Re: "Temporary" Variable

2006-02-24 Thread bonono
Steven D'Aprano wrote: > Just out of curiosity, when do you think is the right time to begin > teaching programmers good practice from bad? Before or after they've > learnt bad habits? When you have authority over the coding guideline. Naming things is not something limited to programming and most

Re: "Temporary" Variable

2006-02-24 Thread Steven D'Aprano
On Fri, 24 Feb 2006 00:24:25 +, Jeffrey Schwab wrote: > Steven D'Aprano wrote: >> On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: >> >> My comments inserted inline. >> >> >> >>>#!/usr/bin/python >>>#simple guessing game, with numbers >>>import random >>>spam = random.randint(1, 100)

Re: "Temporary" Variable

2006-02-23 Thread Jeffrey Schwab
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: > > My comments inserted inline. > > > >>#!/usr/bin/python >>#simple guessing game, with numbers >>import random >>spam = random.randint(1, 100) > > > It is bad programming practice to give variables uninformative

Re: "Temporary" Variable

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: My comments inserted inline. > #!/usr/bin/python > #simple guessing game, with numbers > import random > spam = random.randint(1, 100) It is bad programming practice to give variables uninformative joke names. How about target instead? > p

Re: "Temporary" Variable

2006-02-23 Thread Rick Zantow
[EMAIL PROTECTED] wrote in news:1140725159.143882.202630 @j33g2000cwa.googlegroups.com: > > Steven D'Aprano wrote: >> You could try this: >> >> while 1: >> var = raw_input("Give me some data! ") >> if var == "some data": >> print "Success!" >> break >> else: >>

Re: "Temporary" Variable

2006-02-23 Thread darthbob88
Steven D'Aprano wrote: > [EMAIL PROTECTED] wrote: > > > Problem: I wish to run an infinite loop and initialize a variable on > > each iteration. Sort of like, "Enter Data", test it, "No good!", "Next > > Try?", test it, etc. What I've tried is simply while 1: var1 = > > raw_input, test var1, then

Re: "Temporary" Variable

2006-02-22 Thread Steven D'Aprano
[EMAIL PROTECTED] wrote: > Problem: I wish to run an infinite loop and initialize a variable on > each iteration. Sort of like, "Enter Data", test it, "No good!", "Next > Try?", test it, etc. What I've tried is simply while 1: var1 = > raw_input, test var1, then run through the loop again. What re

Re: "Temporary" Variable

2006-02-22 Thread [EMAIL PROTECTED]
I tried this code and it worked fine: while 1: var1 = raw_input("Enter a number: ") print "You entered:",var1 var1 = int(var1) + 1 print var1 -- http://mail.python.org/mailman/listinfo/python-list

"Temporary" Variable

2006-02-22 Thread darthbob88
Problem: I wish to run an infinite loop and initialize a variable on each iteration. Sort of like, "Enter Data", test it, "No good!", "Next Try?", test it, etc. What I've tried is simply while 1: var1 = raw_input, test var1, then run through the loop again. What results is var1 gets and keeps the f