Re: a couple of questions: pickling objects and strict types
On Sat, Apr 6, 2013 at 5:59 AM, Littlefield, Tyler <email@example.com> wrote:
> I come from a c++ background; though it doesn't help in catching runtime
> errors, being able to compile a program helps catch a lot of syntax errors.
Syntax errors you'll still catch just by attempting to load up the
module in any way:
if True # oops, no colon
You don't need to execute that particular line of code to get the
error. But there are a whole lot of errors that a C++ compiler would
catch that Python leaves until run-time, such as variable name
misspellings, data type mismatches, etc, etc... however, this is part
of what gives Python its flexibility. In fact, a lot of things that
would be errors in C/C++ are actually quite legal and useful in
The one area that I would prefer the C model, though, is declared
variables vs freely-usable names. I prefer the Python notion of
"names" rather than "variables" (the difference takes a lot of words
to explain, but it makes VERY good sense - in a high level language),
but I do like the infinite nesting of scopes and simple catching of
misspellings that the declarations give. Effectively, what I'd like to
see is a declaration "local foo" instead of Python's choice of "global
foo" - with the caveat that globals can be read, but not written,
without that declaration. I think it's clearer and cleaner to declare
all locals. But that's a small matter.
|All times are GMT. The time now is 09:03 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.