a at a.invalid
Thu Jan 6 05:08:13 EST 2005
bearophileHUGS at lycos.com wrote:
> Andrew Dalke:
>>(BTW, it needs to be 1 .. 12 not 1..12 because 1. will be interpreted
>> as the floating point value "1.0".)<
> Uhm, I have to fix my ignorance about parsers.
> Cannot a second "." after the first tell that the first "." isn't in
> the middle of a floating point number?
Python uses an LL(1) parser. From Wikipedia:
""" LL(1) grammars, although fairly restrictive, are very popular because the
corresponding LL parsers only need to look at the next token to make their
>>>This may allow: assert 5 interval 9 == interval(5,9)
>>Maybe you could give an example of when you need this in real life?<
> Every time you have a function with 2 parameters, you can choose to use
> it infix.
But why would you want to? What advantage does this give over the standard
syntax? Remember, in Python philosophy, there should be one obvious way to do
it, and preferably only one. Adding a whole another way of calling functions
complicates things without adding much advantage. Especially so because you
suggest it is only used for binary, i.e. two-parameter functions.
More information about the Python-list