On Sat, 25 Sept 2021 at 02:11, Oscar Benjamin
wrote:
> On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote:
>
>> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin
>> wrote:
>> >
>> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing
>> > wrote:
>> > > I suppose they could be fiddled somehow to make it p
Steve Keller wrote at 2021-9-25 00:15 +0200:
>"Dieter Maurer" writes:
>
>> Steve Keller wrote at 2021-9-24 11:48 +0200:
>> >Why do some built-in Python functions feel so differently:
>>
>> Because the typical use cases are different
>>
>> [...]
>>
>> >while other functions like set.union() and set
On Sun, Sep 26, 2021 at 2:27 AM Dieter Maurer wrote:
>
> Stefan Ram wrote at 2021-9-24 16:48 GMT:
> >"Dieter Maurer" writes:
> >>A list is ordered. Therefore, it is important where
> >>in this order an element is added. Thus, for a list,
> >>`append` is a better name than `add` -- because it alre
Stefan Ram wrote at 2021-9-24 16:48 GMT:
>"Dieter Maurer" writes:
>>A list is ordered. Therefore, it is important where
>>in this order an element is added. Thus, for a list,
>>`append` is a better name than `add` -- because it already
>>tells us in the name where it adds the new element.
>
> In
On Sat, 25 Sept 2021 at 02:16, Chris Angelico wrote:
> On Sat, Sep 25, 2021 at 11:11 AM Oscar Benjamin
> wrote:
> >
> > On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote:
> >>
> >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin
> >> wrote:
> >> >
> >> > On Sat, 25 Sept 2021 at 00:37, Greg E
On Sat, Sep 25, 2021 at 11:11 AM Oscar Benjamin
wrote:
>
> On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote:
>>
>> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin
>> wrote:
>> >
>> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing
>> > wrote:
>> > > I suppose they could be fiddled somehow to make
On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote:
> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin
> wrote:
> >
> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing
> > wrote:
> > > I suppose they could be fiddled somehow to make it possible, but
> > > that would be turning them into special cases
On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin
wrote:
>
> On Sat, 25 Sept 2021 at 00:37, Greg Ewing
> wrote:
>
> > On 25/09/21 10:15 am, Steve Keller wrote:
> > > BTW, I like how the min() and max() functions allow both ways of being
> > > called.
> >
> > That wouldn't work for set.union and set
On Sat, 25 Sept 2021 at 00:37, Greg Ewing
wrote:
> On 25/09/21 10:15 am, Steve Keller wrote:
> > BTW, I like how the min() and max() functions allow both ways of being
> > called.
>
> That wouldn't work for set.union and set.intersection, because as
> was pointed out, they're actually methods, so
On 25/09/21 10:15 am, Steve Keller wrote:
BTW, I like how the min() and max() functions allow both ways of being
called.
That wouldn't work for set.union and set.intersection, because as
was pointed out, they're actually methods, so set.union(some_seq)
is a type error:
>>> a = {1, 2}
>>> b = {
"Dieter Maurer" writes:
> Steve Keller wrote at 2021-9-24 11:48 +0200:
> >Why do some built-in Python functions feel so differently:
>
> Because the typical use cases are different
>
> [...]
>
> >while other functions like set.union() and set.intersection() work on
> >a list of arguments but n
On Sat, Sep 25, 2021 at 3:42 AM Stefan Ram wrote:
>
> "Dieter Maurer" writes:
> >A list is ordered. Therefore, it is important where
> >in this order an element is added. Thus, for a list,
> >`append` is a better name than `add` -- because it already
> >tells us in the name where it adds the new
Stefan Ram wrote at 2021-9-24 14:53 GMT:
>Steve Keller writes:
>>Why do some built-in Python functions feel so differently:
>
>|>>> s = set()
>|>>> s.add( 1 )
>|>>>
>
>
>|>>> l = []
>|>>> l.add( 1 )
>
>|
>|Traceback (most recent call last):
>| File "", line 1, in
>|AttributeError: 'list' object
Steve Keller wrote at 2021-9-24 11:48 +0200:
>Why do some built-in Python functions feel so differently:
Because the typical use cases are different
>For example sum(), all(), any() expect exactly one argument which is a
>sequence to operate on, i.e. a list, an iterator or a generator etc.
>
>
On Fri, Sep 24, 2021 at 11:47 PM Steve Keller wrote:
>
> Why do some built-in Python functions feel so differently:
>
> For example sum(), all(), any() expect exactly one argument which is a
> sequence to operate on, i.e. a list, an iterator or a generator etc.
>
> sum([1,2,3,4])
> sum(ran
Why do some built-in Python functions feel so differently:
For example sum(), all(), any() expect exactly one argument which is a
sequence to operate on, i.e. a list, an iterator or a generator etc.
sum([1,2,3,4])
sum(range(1, 101))
sum(2**i for i in range(10))
all([True, False])
16 matches
Mail list logo