Separators inside a var name
Gary Herron
gherron at islandtraining.com
Mon Jun 9 13:42:48 EDT 2008
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?
> 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.)
> What would be a practical way to
> separate variables from keywords in that case? "some long variable
> name", 'just a string', or maybe using 2 spaces: one var + other
> var + third var ? I think being able to easy have very long names
> for vars that are easy to type would be a fairly significant
> advantage. I know I'm probably being too obsessive about this but
> that didn't stop me from posting. Comments?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list