Newsgroups: comp.lang.python
From: Guido van Rossum <gu...@CNRI.Reston.VA.US>
Date: 1996/08/13
Subject: Re: Steven Miales extensions
> - We are discussing some way to express scope for certains Hmm, these are quite different. 'global' is the only statement that > identifiers, right ? Look at definition of a class, we write > "class foo", or look at a global, we write "global foo". (We do > *not* write @foo, %foo or ___foo.) So writing "var foo ..." for > privacy is consistent. tells the *parser* (or (byte-code) compiler, if you want) something about a name; in all other cases, the parser forgets the name as soon as it's generated the code for it. (Not quite true, since assignments are scanned for evidence of variables, but that's an optimization that's -- mostly -- transparent). > - Using underscore, uppcase letter or some punctuation mark as Not true -- *leading* underscore has a long tradition (in the C world, > prefix or suffix to indicate semantics for an indentifier is, > IMHO, inferior. > + underscore has a long standing tradition of being equal to > [a-z][A-Z] in identifiers, anyway, but we don't really want to ignore that here) of meaning "internal use" (of some kind). ANSI C has exact rules for the use of names with single and double leading underscore (anything beginning with two underscores or with an underscore and an upper case letter is reserved for the compiler). Python follows this lead: ``from M import *'' does not import names > + making letter uppercase to be syntax to indicate special No dispute there. There are too many conflicting conventions for when > identifier semantics > is *error prone*, just like . vs. .. or _ vs. __ , and to use upper case to make any sense out of them. This is as bad as Fortran's ``implicit integer (i-n)''. For many people it takes considerable effort to notice that "Spam" and "spam" are spelled differently. > + use of punctuation marks gives real uggly code (save them for Agreed. Therein lies the road to Perl :-) Peter Munnings' choice of > operators where they do proper job). `.' was very tasteful by comparison, but still not good enough (in my eyes anyway). > I can live with the already defined scheme for builtins because It may not be enforced by syntax, but it's enforced by the virtual > that's primarily a naming convention, it's not enforced by syntax. machine, which is practically as strong a force. > - To those who feel it very important that scope is reflected in the Python is an experiment in how much freedom programmers need. Too > name, it's free to use whatever naming scheme. In the process of > scrutinizing other peoples code, finding out the scope for a > certian identifier is, to my experience, a lesser effort > regardless what language it happen to be. much freedom and nobody can read another's code; too little and expressiveness is endangered. Python has a little less freedom than C -- for example, it enforces more consistent use of indentation. You are still free to choose by how much you indent your code so it looks good to your eyes, and you can mix spaces and tabs if your editor has that habit, but you have to be consistent in the indentation of your code body. Nobody has complained about *that* (the complaints have been about not having braces as well). Enforcing capitalization rules isn't quite the same. There are many I believe that enforcing the leading double underscore to mean private I'm not putting this in 1.4, but I'm very tempted to put it in the --Guido van Rossum (home page: http://www.python.org/~guido/) You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||