Separators inside a var name
andrei.avk at gmail.com
Mon Jun 9 20:01:29 CEST 2008
On Jun 9, 1:42 pm, Gary Herron <gher... at islandtraining.com> wrote:
> Rainy wrote:
> > I have a stylistic question. In most languages words in var. name are
> > separated by underscores or cap letters, resulting in var names like
> > var_name, VarName and varName. I don't like that very much because all
> > 3 ways of naming look bad and/or hard to type. From what I understand,
> > scheme can have variables like var-name. I'm curious about reasons
> > that python chose to disallow this.
> Because we'd prefer var-name to mean subtraction of values: var minus
> name. If you want to use a that character in names, what syntax would
> you prefer for subtraction? Do you consider lisp/scheme (- a b) to be
> reasonable in Python?
I would make it that var - var2 would be subtraction and var-name
a var name. I don't like (- a b) but I might have preferred it if it
allowed dashes inside var names, if I got used to it. Hard to say.
> > Another question I have is what
> > other languages allow this naming scheme? Were there any languages
> > that allowed space as a separator?
> Fortran used to. (Haven't checked in on it in years though so I don't
> know now). And it not so much as allowed spaces as it *ignored* all
> spaces. This was now-a-days considered a *really* bad idea, and is
> rumored to be responsible for a bug that crashed a satellite. (At least
> that's the way a nice urban legend tells it.)
Well, if I understand right, fortran used caps for many things? I'm
how it separated things if it ignored all spaces. I'll trust you that
not a good idea :-). However that's not what I meant, I'd just like to
(or rather try using) spaces inside var names.
More information about the Python-list