Python Newbie

piterrr.dolinski at gmail.com piterrr.dolinski at gmail.com
Sat Feb 23 00:38:53 CET 2013


Hi Ian,

Thanks for typing all this for me. Really useful. I did some googling of my own and I found that there was no concept of boolean in older versions of Python like you said. (BTW, how does this omission go well with proper language design, as Oscar seems to have hinted?) I think this obvious shortcomming is the main reason that, for example, when x holds the value of 5, x is considered to be "true". You see, I have to maintain Python files (ubuntu server scripts) which are 2000 lines long, all sequential code, no functions. While the person who wrote them should be shot :), the fact that there is inherent ambiguity with value, none, null 0, you name it, in conditional statements is not helping me understand the code, and this adds to my frustration.


I messed up my

if (some statement):            # short form

in the example I gave, but you figured exactly what I mean. Of course if the condition (some statement) is boolean there is no point adding "== true" or similar. But if (some statement) represents a value this is where I have trouble and again the origins of this date back to when Python had no boolean type. So now at least I understand it.

Btw, there are still languages with no boolean type today, MySQL for one. This creates big efficiency problems when fetching data from the database into a C# program - what should be a bool is fetched as an 8-byte integer! But that's a different story. I shut up now.

As I said I am new to Python, learning it, I have to get more experience with passing parameter values to functions, as I do with mostly everything else.

Cheers.

Peter



More information about the Python-list mailing list