[Python-Dev] RE: PEP 285: Adding a bool type

Patrick K. O'Brien pobrien at orbtech.com
Sat Mar 30 09:13:26 EST 2002


[Tim Peters]
>
> [Christian Tanzer]
> > ...
> > How will bool influence '__nonzero__'? Currently, Python insists that
> > '__nonzero__ should return an int'. Will this be changed to 'should
> > return a bool'?
>
> I hope so.
>
> > As that would break existing code, I hope not.
>
> No, "should" != "must".  Guido won't call code that returns an int here
> broken, although he might call it deprecated, and leave you wondering when
> the hammer will drop <wink>.

What is the likelihood that __nonzero__ could be renamed (at some point in
the future) to something a bit more intuitive, like __bool__? I know there
would be a lot of user code to change, but assuming one day the hammer will
drop and everyone's __nonzero__ will have to change to return a bool, I
wouldn't mind seeing the method renamed as well.  Or is this a lost cause at
this point?

---
Patrick K. O'Brien
Orbtech





More information about the Python-list mailing list