Separators inside a var name

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Mon Jun 9 17:39:44 EDT 2008


On 9 juin, 20:05, "Sebastian \"lunar\" Wiesner"
<basti.wies... at gmx.net> wrote:
>  Rainy <andrei.... at gmail.com> at Montag 09 Juni 2008 19:29:
>
(snip)
> > From what I understand, scheme can have variables like var-name. I'm
> > curious about reasons that python chose to disallow this.
>
> "-" is an operator in Python.  How should the parser know,
> whether "var-name" means "the object bound to var_dash_name" or "subtract
> the object bound to name from the object bound to var"?
>
> Scheme can allows such names, because its a functional programming language.

Nope. Scheme and most lisps AFAICT allow such names because of lisp's
syntax, period. Scheme being (more or less) a functional language is
mostly unrelated. FWIW, there are pure functional languages that use
an infix operator syntax just like Python (and FWIW, Python itselfs
uses functions to implement operators) and don't accept dashes in
identifiers for the same reasons as Python : parsing ambiguity.

(snip)




More information about the Python-list mailing list