[Python-ideas] "Exposing" `__min__` and `__max__`
mike at selik.org
Wed Jun 27 11:30:25 EDT 2018
On Wed, Jun 27, 2018 at 8:16 AM Franklin? Lee <leewangzhong+python at gmail.com>
> On Wed, Jun 27, 2018, 10:31 Steven D'Aprano <steve at pearwood.info> wrote:
>> On Wed, Jun 27, 2018 at 06:52:14AM -0700, Michael Selik wrote:
>> > My intent was to ask where a range was in fact passed into max, not
>> > where it could be. It'd be enlightening to see a complete, realistic
>> > example.
>> A complete, realistic example is as I said: you call max() on some
>> object which you don't control, the caller does. You could be
>> passed a list, or a set, or a bitset, a binary search tree, a range
>> object, whatever the caller happens to pass to you.
> Let's just assume Michael wants to know, and isn't making an argument
> against the proposal.
I do want to know, but it's also an argument against the proposal -- that
no one has contributed in-context usage to demonstrate the value. I'd want
to see code that currently uses ``if isinstance`` to switch between
``max(x)`` and ``x.max()``. Chris Barker explained the issue well.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas