Re: Declaring variables

2007-05-17 Thread HMS Surprise
On May 17, 9:34 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-05-16, HMS Surprise <[EMAIL PROTECTED]> wrote: > > > No haven't had to endure Pascal. Mostly C/C++, Tcl, and assembler. > > I must have you mixed up with somebody else who recently > mentioned having Pascal as their first real l

Re: Declaring variables

2007-05-17 Thread Grant Edwards
On 2007-05-16, HMS Surprise <[EMAIL PROTECTED]> wrote: > No haven't had to endure Pascal. Mostly C/C++, Tcl, and assembler. I must have you mixed up with somebody else who recently mentioned having Pascal as their first real language. -- Grant Edwards grante Yow! I

Re: Declaring variables

2007-05-17 Thread Gregor Horvath
HMS Surprise schrieb: > > #~~ > createdIncidentId = 0 > . > . > . > #attempt to change varialbe > createdIncidentID = 1 > . > . > . > if createdIncidentId == 1: >... > test.py is your code above $ pychecker -v test.py Processing test... Warnings... test.py:7: Variable

Re: Declaring variables

2007-05-17 Thread HMS Surprise
On May 16, 6:48 pm, Matimus <[EMAIL PROTECTED]> wrote: > On May 16, 9:57 am, HMS Surprise <[EMAIL PROTECTED]> wrote: > > > I looked in the language but did not find a switch for requiring > > variables to be declared before use. > > > Is such an option available? > > > Thanks, > > > jvh > > You do

Re: Declaring variables

2007-05-16 Thread Steve Holden
Matimus wrote: > On May 16, 9:57 am, HMS Surprise <[EMAIL PROTECTED]> wrote: >> I looked in the language but did not find a switch for requiring >> variables to be declared before use. >> >> Is such an option available? >> >> Thanks, >> >> jvh > > You do have to declare a variable before use. You

Re: Declaring variables

2007-05-16 Thread Matimus
On May 16, 9:57 am, HMS Surprise <[EMAIL PROTECTED]> wrote: > I looked in the language but did not find a switch for requiring > variables to be declared before use. > > Is such an option available? > > Thanks, > > jvh You do have to declare a variable before use. You do so by assigning it a value

Re: Declaring variables

2007-05-16 Thread HMS Surprise
No haven't had to endure Pascal. Mostly C/C++, Tcl, and assembler. Oh yeah, and a (thankfully) short stint of Ada. But I glad to hear of the proofing tools. Working a lot of data parsed from web pages and the developer there a different naming convention from what I am accustomed so sometimes I i

Re: Declaring variables

2007-05-16 Thread Grant Edwards
On 2007-05-16, HMS Surprise <[EMAIL PROTECTED]> wrote: > I looked in the language but did not find a switch for requiring > variables to be declared before use. Still trying to write Pascal, eh? ;) > Is such an option available? No. However, there are utilities to "proofread" your code should

Declaring variables

2007-05-16 Thread HMS Surprise
I looked in the language but did not find a switch for requiring variables to be declared before use. Is such an option available? Thanks, jvh -- http://mail.python.org/mailman/listinfo/python-list

Re: Declaring variables from a list

2005-04-09 Thread Cactus
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > "Cactus" wrote: > > > If I got a list is it possible to declare a variable from the items in that > > list? > > > > Code Sample: > > Blob = ['Var1', 'Var2', 'vAR3'] > > i = 5 > > for listitems in Blob: > >i +=

Re: Declaring variables from a list

2005-04-09 Thread Pierre Quentel
You can use the built-in statement exec (http://www.python.org/doc/2.4.1/ref/exec.html) : # Blob = ['Var1', 'Var2', 'vAR3'] # i = 5 # for listitems in Blob: # i += 1 # exec('%s = i' %listitems) # # print Var1, Var2, vAR3 Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-li

Re: Declaring variables from a list

2005-04-08 Thread Sidharth Kuruvila
What I gave was a bad solution. Something that works right now, but probably shouldn't be done. On Apr 9, 2005 3:37 AM, Inyeol Lee <[EMAIL PROTECTED]> wrote: > On Sat, Apr 09, 2005 at 03:15:01AM +0530, Sidharth Kuruvila wrote: > > Python has a builtin function called locals which returns the local

Re: Declaring variables from a list

2005-04-08 Thread Inyeol Lee
On Sat, Apr 09, 2005 at 03:15:01AM +0530, Sidharth Kuruvila wrote: > Python has a builtin function called locals which returns the local > context as a dictionary > > >>> locals = locals() > >>> locals["a"] = 5 > >>> a > 5 > >>> locals["a"] = "changed" > >>> a > 'changed' >From Python lib referen

Re: Declaring variables from a list

2005-04-08 Thread Sidharth Kuruvila
Python has a builtin function called locals which returns the local context as a dictionary >>> locals = locals() >>> locals["a"] = 5 >>> a 5 >>> locals["a"] = "changed" >>> a 'changed' On 8 Apr 2005 13:55:39 -0700, Cactus <[EMAIL PROTECTED]> wrote: > Hi, > > If I got a list is it possible to de

Re: Declaring variables from a list

2005-04-08 Thread Fredrik Lundh
"Cactus" wrote: > If I got a list is it possible to declare a variable from the items in that > list? > > Code Sample: > Blob = ['Var1', 'Var2', 'vAR3'] > i = 5 > for listitems in Blob: >i += 1 >listitems = i > > print Var1 > 6 > print Var2 > 7 > print vAR3 > 8 > > Something like that? T

Declaring variables from a list

2005-04-08 Thread Cactus
Hi, If I got a list is it possible to declare a variable from the items in that list? Code Sample: Blob = ['Var1', 'Var2', 'vAR3'] i = 5 for listitems in Blob: i += 1 listitems = i print Var1 6 print Var2 7 print vAR3 8 Something like that? This doesn't work (obviously) but is the