Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42869 > unrolled thread

Re: a couple of questions: pickling objects and strict types

Started byChris Angelico <rosuav@gmail.com>
First post2013-04-06 11:31 +1100
Last post2013-04-06 11:31 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: a couple of questions: pickling objects and strict types Chris Angelico <rosuav@gmail.com> - 2013-04-06 11:31 +1100

#42869 — Re: a couple of questions: pickling objects and strict types

FromChris Angelico <rosuav@gmail.com>
Date2013-04-06 11:31 +1100
SubjectRe: a couple of questions: pickling objects and strict types
Message-ID<mailman.172.1365208304.3114.python-list@python.org>
On Sat, Apr 6, 2013 at 5:59 AM, Littlefield, Tyler <tyler@tysdomain.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:

def foo():
  if True   # oops, no colon
    pass

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
Python.

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.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web