Python Newbie
Roy Smith
roy at panix.com
Sun Feb 24 19:50:22 EST 2013
In article <da0ec7a1-decd-4cfb-9a0b-5722879f5864 at googlegroups.com>,
piterrr.dolinski at gmail.com wrote:
> Yes I did see that it is possible to redefine the type of a variable. But I
> don't think I would ever do this intentionally
One does not need language features to protect themselves against things
they do intentionally. They need language features to protect
themselves against things they do by accident. Different languages
protect you from different things.
Compare, for example, C++ and Python.
C++ protects you against accidentally passing an int where you were
supposed to pass a float. Well, no, with automatic type promotion,
that's a bad example. But it does prevent you from passing an IntThing
where you were supposed to pass a FloatThing (assuming IntThing is not a
subclass of FloatThing, and a few other details).
But, Python protects you from dereferencing a null pointer, or
double-freeing a pointer. There's just no way to even write those
concepts in Python.
You pays your money and you takes your chances. Pick which type of
protection you feel is more important and use the language which gives
you that.
> need to be really careful with Python.
You need to be really careful with all programming languages. You just
need to be careful about different things.
More information about the Python-list
mailing list