[Python-ideas] Non-boolean return from contains (original) (raw)

Jack Diederich jackdied at gmail.com
Sun Jul 25 23:32:21 CEST 2010


On Sun, Jul 25, 2010 at 5:20 PM, Bruce Leban <bruce at leapyear.org> wrote:

Let me see if I understand this:

False in [False] Returns True now but would return False with your change.

Bigtime. Official side-effects are neat for hacks but bad for maintainable code. You don't know pain until another developer complains that you refactored user.is_admin() to no longer return the user's object (for the record that happened in perl, but it could in python too). Boolean test operations should return bools for the same reason that in-place operations should return None.

-Jack



More information about the Python-ideas mailing list