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 have to declare a
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
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!
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 language.
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
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
you
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
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. You
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 do so by assigning
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
--
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 += 1
listitems = i
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
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? This doesn't work
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 declare a variable from the
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 reference:
locals()
...
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
16 matches
Mail list logo