[Tutor] Const on Python

Kent Johnson kent37 at tds.net
Thu Mar 6 14:35:51 CET 2008


Tiago Katcipis wrote:
> thanks for the help Andreas, i dont really need that much a const so i 
> wont do anything like that to have a const like data. I am very used to 
> java and c++, thats why i always used acess modifier, but i think i can 
> live without it now i know that it dont exist in python :P.

My experience, moving from C++ to Java to Python as the language I use 
every day at work:

C++ is extremely complex. The good side of this is it gives you 
tremendous control - final, const, pass by reference or value, memory 
allocation, etc, etc. The bad side is that it is a lot to think about - 
should this parameter be const? who is going to deallocate this object? 
and there is a lot of room for error, whole books have been written on 
the topic (e.g. Effective C++ which even has a sequel).

Java is less complex and flexible than C++. At first I missed the 
control of C++, then I realized that it wasn't really buying me much and 
that the cost was too high - coding Java is much less work than coding C++.

Then Python. Python takes away even more low-level control. And I don't 
miss it at all. My Python programs work just fine without static typing, 
constants, etc.

Python is simple and flexible and just does what I want with no fuss. 
Java is a heavy straightjacket. C++ is inconceivably complex.

So relax and enjoy it, the only risk is that you will never want to 
touch Java and C++ again.

:-)

Kent


More information about the Tutor mailing list