code review

Alister alister.ware at ntlworld.com
Sat Jun 30 16:30:45 EDT 2012


On Sat, 30 Jun 2012 21:38:58 +0200, Thomas Jollans wrote:

> On 06/30/2012 08:39 PM, Thomas 'PointedEars' Lahn wrote:
>> Peter Otten wrote:
>> 
>>> If you spell it
>>>
>>> def is_valid_password(password):
>>>     return mud.minpass <= len(password) <= mud.maxpass
>>>
>>> it is even easier to see that you are performing an interval check.
>> 
>> This is probably a tautology around here, but *what* *a* *great*
>> *programming* *language*.
>> 
>> 
> Personally, I don't like this feature of the language. I find a ternary
> operator that uses symbols that can also be binary operators confusing
> and inconsistent with the way operators usually work/the way terms are
> usually associated.
> 
> It has the charm of being something you'd "naturally" write in the
> context of non-programming mathematics, at the cost of being very odd
> indeed in the context of programming in general and Python in
> particular.

Surely this fits perfectly with the lines 1 & 7 in the zen of python 
(import this)
"Beautifull is better than ugly" and "Readability counts"

I find that construct both beautiful and readable, if it cannot be used 
in the languages then that is their loss.



-- 
Removing the straw that broke the camel's back does not necessarily
allow the camel to walk again.



More information about the Python-list mailing list