[Python-ideas] Break the dominance of boolean values in boolean context
bruce at leapyear.org
Wed Sep 14 03:08:27 CEST 2011
On Tue, Sep 13, 2011 at 8:05 AM, Lukas Lueg <lukas.lueg at googlemail.com>wrote:
> 2011/9/13 Ron Adam <ron3200 at gmail.com>:
> > On Mon, 2011-09-12 at 21:40 -0400, Devin Jeanpierre wrote:
> >> Can we not allow things like `a < b` to return non-boolean values,
> >> without altering the behaviour of existing Python types?
> > Would that return 'a' or 'b', or something else?
> That depends on the object at hand. 'a < b' could return 'b - a' for
> set-like objects. Read 'a < b' as the answer to the question 'how much
> bigger is b than a?'.
Then what would a <= b or a == b or a != b return? This idea of returning
'how far apart are these objects' doesn't generalize for integers much less
more complex types. You can't design a new feature by giving one example ...
and no use cases.
Follow me: http://www.twitter.com/Vroo http://www.vroospeak.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas