Re: Python: Does It Have Strict Mode Or Something?
- From: Q <q@xxxxxxxxxxxxxxxxxx>
- To: programmingblind@xxxxxxxxxxxxx
- Date: Thu, 16 Jun 2011 10:00:50 -0400
If you try to read from an uninitialized variable, you'll get a NameError.
Thankfully Python isn't BDSM-oriented enough to have any sort of strict
mode. Just part of the dynamic typing and type inference. At least all
variables don't default to None, as they do in Ruby, where everything is
Nil until initialized...
On 6/16/2011 9:46 AM, Homme, James wrote:
Hi,
In Perl, you can put use strict. In VB, you can put explicit on. Does
Python have something you can do to force you to initialize variables?
I'm concerned about accidental misspellings of variable names.
Thanks.
Jim
Jim Homme,
Usability Services,
Phone: 412-544-1810.
This e-mail and any attachments to it are confidential and are
intended solely for use of the individual or entity to whom they are
addressed. If you have received this e-mail in error, please notify
the sender immediately and then delete it. If you are not the intended
recipient, you must not keep, use, disclose, copy or distribute this
e-mail without the author's prior permission. The views expressed in
this e-mail message do not necessarily represent the views of Highmark
Inc., its subsidiaries, or affiliates.
Other related posts: