On Thu, Aug 23, 2012 at 5:03 AM, lipska the kat <lipskathe...@yahoo.co.uk> wrote: > On 22/08/12 19:15, Ian Kelly wrote: >> >> You're conflating "strong typing" with "static typing". Strong typing >> does not refer to restrictions on what type of data can be stored >> where, but to restrictions on how operations on that data can be >> intermixed. > > Yes of course I am, thank you for pointing that out. > I don't know why I have this overwhelming need to see variables explicitly > defined ... years of 'same old same old' I suppose.
Python's object model is not fundamentally incompatible with a system of declared variables. I, too, like declaring my variables explicitly. There are quite a few advantages to it: 1) Scoping is extremely clear. (Leaving aside anomalous behaviour like Javascript's "var" declarations applying to a whole function.) You see a declaration, you know that variable exists there and further inside only. In a C-style language, that means it disappears at the corresponding close brace. 2) Related to the above, you can infinitely nest scopes. There's nothing wrong with having six variables called 'q'; you always use the innermost one. Yes, this can hurt readability, especially taken to this sort of stupid extreme, but that's a question for a style guide and not a language design. 3) Variable-name typos can be caught at parse time. In Python, if you misspell a variable, you've just made a new local variable. It has its downsides, too, of course; mainly that it's (in some people's opinion) syntactic salt. Why should I have to tell the interpreter/compiler what it can figure out by itself? It's duplicating information, and that's inefficient. It's like forcing all your integer constants to be given in both decimal and hex, to catch errors. I'm of the opinion that the benefits are worth the effort. Others disagree. It's hugely a matter of taste, and I'm just glad that there are enough languages around that we can all have what we want :) If you like the Python object model but want to add variable declarations, grab me off list and I'll tell you about my personal favorite language... ChrisA -- http://mail.python.org/mailman/listinfo/python-list