Other notes

Steve Holden steve at holdenweb.com
Thu Jan 6 08:45:21 EST 2005


Timo Virkkala wrote:

> 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 parsing decisions."""
> 
Indeed, but if ".." is defined as an acceptable token then there's 
nothing to stop a strict LL(1) parser from disambiguating the cases in 
question. "Token" is not the same thing as "character".

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

This part of your comments I completely agree with. However, we are used 
to people coming along and suggesting changes to Python on 
comp.lang.python. Ironically it's often those with less experience of 
Python who suggest it should be changed to be more like some other language.

One of the things I like best about c.l.py is its (almost) unfailing 
politeness to such posters, often despite long stream-of-consciousness 
posts suggesting fatuous changes (not necessarily the case here, by the 
way). The level of debate is so high, and so rational,  that the change 
requesters are often educated as to why their suggested changes wouldn't 
be helpful or acceptable, and having come to jeer they remain to 
whitewash, to use an analogy from "Tom Sawyer" [1].

All in all a very pleasant change from "F*&% off and die, noob".

regards
  Steve

[1]: http://www.cliffsnotes.com/WileyCDA/LitNote/id-2,pageNum-10.html
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list