piterrr.dolinski at gmail.com
piterrr.dolinski at gmail.com
Fri Feb 22 22:37:20 CET 2013
Thanks to everyone for all the posts, some friendly some not. I read all of them with genuine interest.
So I am continuing to learn Python, here are my new observations for your consideration.
There seems to be a "heated" argument about Python's apparently intentional ambiguity in conditional statements. Specifically, the issue is, is it more appropriate to write (as an example)
if (some statement): # short form
if (some statement == true): # long form
Some 50(?) years ago, C was designed so that everything other than 0 evaluated to true and was false otherwise. Fast forward to recent memory, when C# was designed, Microsoft claims they reviewed all the features of C, C++ and Java, pulled the best features from each of these languages and designed a new language that would help minimize the potential for planting bugs. Say what you want about MS inventions, but my experience is that to require the long form notation was a good decision. For me the fact that the short notation is legal in Python is a stepback in language design. Python inventors, when creating what is after all considered a contemporary language, should have known better. Call me psychopath if you will (have seen this in one post), but I shall continue to use the aforementioned long form as I always have, and no Python is going to change that.
Today I learned the hard way that all function parameters in Python are passed by reference (meaning whatever happens to them inside a function, new values are always passed to caller). Not good. I got caught up on this. To combat the mostly unwanted behavior, inside a function I have to reassign variables intended to be local to new variables. A pain. Can anyone offer ONE reason why Python was designed that way?
Out of curiosity, does anyone have any idea why function declarations are preceded by the keyword "def" rather than something more intuitive like "function" or at least "func", perhaps?
Does anyone know what the benefit of writing the cryptic "elif" to mean "else if" is? Curiously, the default statement in an if/else chain is preceded by "else" and not "el".
Someone said I am too narrow-sited appreciating C# and not open to alternate approaches to language design. Well if that someone says "def" is better than "function" and "elif" is better than "else if", then dare I say, you are obsessed with Python!
So far I am getting the impression that Python is a toy language of some kind (similar to Basic of the early 80's), not really suitable for serious work. The only difference between these languages (admittedly, a serious one) is the existence of extensive libraries. Otherwise there would be no good reason for Python to exist. Nevertheless, it does exist and I have to learn it. As long as someone is paying for my time, that's OK with me.
More information about the Python-list