On 25 July 2010 22:32, Jack Diederich <jackdied@gmail.com> wrote:
On Sun, Jul 25, 2010 at 5:20 PM, Bruce Leban <bruce@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


Most of them don't and this can be useful. Why should __contains__ enforce it when other boolean operations don't? Inconsistency is also bad.

 
for the same
reason that in-place operations should return None.


What do you mean by "in-place operations should return None"?

For mutable objects __iadd__ and friends should return self. For immutable ones they return the new value. Probably I misunderstand what you mean.

Michael

 

-Jack
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas



--
http://www.voidspace.org.uk