Separators inside a var name

Sebastian "lunar" Wiesner basti.wiesner at gmx.net
Tue Jun 10 13:46:02 CEST 2008


 bruno.desthuilliers at gmail.com <bruno.desthuilliers at gmail.com> at Montag 09
Juni 2008 23:39:

> 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.

Of course, you're right.  My words were badly chosen, I just wanted to point
out, that scheme can allow such names, because it doesn't use operators but
functions for things like subtraction.  My bad, sorry

-- 
Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)



More information about the Python-list mailing list