[Python-ideas] change list() - branch from "More useful slices"
Georg Brandl
g.brandl at gmx.net
Mon Feb 2 23:21:00 CET 2015
On 02/02/2015 11:03 PM, Eugene Toder wrote:
> On Mon, Feb 2, 2015 at 4:19 PM, Ryan Gonzalez
> <rymg19 at gmail.com
> <mailto:rymg19 at gmail.com>> wrote:
>
> On Mon, Feb 2, 2015 at 1:47 PM, Thomas Kluyver
> <thomas at kluyver.me.uk
> <mailto:thomas at kluyver.me.uk>> wrote:
>
> max() and min() do behave like this - they accept either a single
> iterable, or *args - so it's not unprecedented. But I don't see any
> benefit to adding it to the list() constructor.
>
>
> Because the maximum/minimum of a single value makes absolutely no sense, but
> a single-element list does.
>
> Arguably, min and max of a single value is that same value. This is what min()
> and max() return when you pass them a 1-element sequence.
Yes, but that's beside the point. The point is that for max and min
it is never needed to write "min(a)" or "max(a)" where a is not a
sequence -- since it's the same as just "a".
Georg
More information about the Python-ideas
mailing list