Michiel Overtoom writes:

> Why not use a function?
>
>
>     if outside(x, 0, 10):
>         print("x has wrong value")
>     else:
>         print("x has good value")
>
>
> where 'outside' is defined as:
>
>     def outside(value, lowerbound, upperbound):
>         return value < lowerbound or value > upperbound  

Wouldn't that be more readable as:?

     def outside(value, lowerbound, upperbound):
         return not (lowerbound <= value <= upperbound)

Just wondering ...
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to