Newcomer struggling with tutorial

Todd Stephens Huzzah! at Huzzah.com
Sun Oct 5 18:58:36 CEST 2003


CPK Smithies wrote in article <blpf2k$fef$1 at titan.btinternet.com>:

> 
> Perhaps some people enjoy mastering quirks like these. I just see it as a
> source of confusion and errors. What's so terrible about having to type
> "(a < b) && (b == c)" if that's what is intended? Is it really worth
> sacrificing a logical grammar for the sake of a few keystrokes? So it's
> not a bug in implementation that I'm talking about. It's a bug in the
> design.

It is neither.  If you wished to type it either way, you could:

>>> def test(a,b,c):
...   if a<b==c:
...     return 1
...   else:
...     return 0
...
>>> test(2,4,4)
1
>>> test(2,3,4)
0
>>> def test2(a,b,c):
...   if (a<b) and (b==c):
...     return 1
...   else:
...     return 0
...
>>> test2(2,4,4)
1
>>> test2(2,3,4)
0


-- 
Todd Stephens
ICQ# 3150790
"A witty saying proves nothing." -Voltaire




More information about the Python-list mailing list