A
asincero
Is there anyway to catch the following type of bug in Python code:
message = 'This is a message'
# some code
# some more code
if some_obscure_condition:
nessage = 'Some obscure condition occured.'
# yet more code
# still more code
print message
In the above example, message should be set to 'Some obscure condition
occured.' if some_obscure_condition is True. But due to a lack of
sleep, and possibly even being drunk, the programmer has mistyped
message. These types of bugs would easily be caught in languages that
have a specific keyword or syntax for declaring variables before use.
I'm still fairly new to using Python on a more than casual basis, so I
don't know if Python has anyway to help me out here.
-- Arcadio
message = 'This is a message'
# some code
# some more code
if some_obscure_condition:
nessage = 'Some obscure condition occured.'
# yet more code
# still more code
print message
In the above example, message should be set to 'Some obscure condition
occured.' if some_obscure_condition is True. But due to a lack of
sleep, and possibly even being drunk, the programmer has mistyped
message. These types of bugs would easily be caught in languages that
have a specific keyword or syntax for declaring variables before use.
I'm still fairly new to using Python on a more than casual basis, so I
don't know if Python has anyway to help me out here.
-- Arcadio