On Friday, August 22, 2014 8:20:22 PM UTC+1, Ralf Hemmecke wrote:
>
> I hate it when someone documents 'test whether this and that holds'. Or 
> is there some convention that a test returns true if something holds and 
> false otherwise? 
>

Is there anybody returning "False" if the property holds? Probably not. 

If the method is named well, for example is_foo() or has_property(), then 
it is self-explanatory that the result is boolean and what True means. If 
you still have doubts there is also the "OUTPUT:" section of the 
doctstrings to clear it up.

Suppose you have: 
> "nonzero(x) tests whether x is zero or not" 
>

Of course __nonzero__() is a Python magic method, but let's ignore that for 
the sake of the argument. 

Your example is confusing because the method name is not expressive enough. 
Call it is_nonzero() and it is much clearer. Or maybe ensure_nonzero(x) if 
you want to return x if x!=0 and something else if x==0.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to