
Alexander Myodov <maa_public@sinn.ru> wrote: [snip Alexander Myodov complaining about how Python works]
i = 0 while i != 1: i += 1 j = 5 print j
Maybe you don't realize this, but C's while also 'leaks' internal variables... int i = 0, j; while (i != 1) { i++; j = 5; } printf("%i %i\n", i, j); If you haven't yet found a good use for such 'leakage', you should spend more time programming and less time talking; you would find (quite readily) that such 'leaking' is quite beneficial.
I made several loops, one by one, using the "i" variable for looping. Then in the latest loop I changed the "i" name to more meaningful "imsi" name in the "for" declaration and whenever I found inside the loop. As I use "i" name *for loops exclusively*, I didn't wittingly reuse the same name for different purposes. The problem was that I missed one occurance of "i" variable inside the loop code, so it gained the same value (from the completion of previous loop) throughout all the "imsi" loop. And the interpreter didn't notice me that "I am using the undefined variable" (since it is considered defined in Python), as accustomed from other languages. That's my sorrowful story.
So you mistyped something. I'm crying for you, really I am.
But for the "performance-oriented/human-friendliness" factor, Python is anyway not a rival to C and similar lowlevellers. C has pseudo-namespaces, though.
C does not have pseudo-namespaces or variable encapsulation in for loops. Ah hah hah! Look ladies and gentlemen, I caught myself a troll! Python does not rival C in the performance/friendliness realm? Who are you trying to kid? There is a reason why high school teachers are teaching kids Python instead of Pascal, Java, etc., it's because it is easier to learn and use. On the performance realm, of course Python is beat out by low-level languages; it was never meant to compete with them. Python does what it can for speed when such speed does not affect the usability of the language. What you are proposing both would reduce speed and usability, which suggests that it wasn't a good idea in the first place.
JC> Python semantics seem to have been following the rule of "we are all JC> adults here". I always believed that the programming language (as any computer program) should slave to the human, rather than a human should slave to the program.
Your beliefs were unfounded. If you look at every programming language, there are specific semantics and syntax for all of them. If you fail to use and/or understand them, the langauge will not be your 'slave'; it will not run correctly, if at all.
"for (int i = 0; i < 10; i++)" works fine nowadays.
I'm sorry, but you are wrong. The C99 spec states that you must define the type of i before using it in the loop. Maybe you are thinking of C++, which allows such things.
JC> Also: python-dev is a mailing list for the development /of/ Python. JC> Being that your questions as of late have been in the realm of "why does JC> or doesn't Python do this?", you should go to python-list (or the JC> equivalent comp.lang.python newsgroup) for answers to questions JC> regarding current Python behavior, and why Python did or didn't do JC> something in its past. I'm sorry for wasting the time of developers. For "for/while/if" statements, I just had an idea which (I believed) could be useful for many peoples,
Test your ideas on comp.lang.python first, when more than a handful of people agree with you, come back. - Josiah