From: bill.gunshannon@gmail.com   
      
   On 8/29/2025 9:11 AM, Dan Cross wrote:   
   > In article <108k9de$1f69$1@dont-email.me>,   
   > Simon Clubley wrote:   
   >> On 2025-08-25, Arne Vajhøj wrote:   
   >>> On 8/24/2025 10:34 PM, Lawrence D?Oliveiro wrote:   
   >>>>   
   >>>> One trick they missed was allowing interval comparisons like this:   
   >>>>   
   >>>> if "0" <= ch <= "9" or "a" <= ch <= "f" or "A" <= ch <= "F" :   
   >>>>   
   >>>> I think only Python has that.   
   >>>   
   >>> Yes.   
   >>>   
   >>> But note that the feature is not "interval comparison" but   
   >>> "chaining comparison operators".   
   >>>   
   >>> The above example is very readable and makes sense.   
   >>   
   >> Just don't try getting that code past me without first having used   
   >> brackets around the subexpressions. :-)   
   >>   
   >>> But it is less obvious with other operators.   
   >>>   
   >>> Example:   
   >>>   
   >>> 4 == 4 == True   
   >>>   
   >>> Most languages (possible all exception Python) evaluate   
   >>> that to True, because it is treated like:   
   >>>   
   >>> (4 == 4) == True   
   >>>   
   >>> But it is False in Python because it is treated like:   
   >>>   
   >>> (4 == 4) and (4 == True)   
   >>>   
   >>> Which feels less natural.   
   >>   
   >> And _this_ is an example of why Simon's policy of backets around   
   >> everything makes it explicitly clear what was intended. :-)   
   >   
   > *At some expense for expert users.   
   >   
   > Which again, comes back to what I think is _actually_ the   
   > interesting question: who do we write these programs for?   
      
   Which is why I always preferred working for people with well defined   
   local coding (and comment) standards. And, yes, I have worked for both.   
      
   bill   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|