[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread Christopher Barker
On Tue, Dec 28, 2021 at 10:19 AM Chris Angelico wrote: > I'm not sure about that. > > >>> numpy.log(2.71828) > 0.99327347282 > >>> numpy.log([2.71828]) > array([0.9933]) > >>> type(numpy.log(2.71828)) > > >>> type(numpy.log([2.71828])) > > well, yes, there is a odd wart in numpy that

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread Chris Angelico
On Wed, Dec 29, 2021 at 4:54 AM Christopher Barker wrote: > > On Tue, Dec 28, 2021 at 5:31 AM David Mertz, Ph.D. > wrote: >> >> On Tue, Dec 28, 2021 at 1:15 AM Christopher Barker >> wrote: >>> >>> On Mon, Dec 27, 2021 at 4:07 PM Steven D'Aprano Julia (if I recall correctly) has a

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread Christopher Barker
On Tue, Dec 28, 2021 at 5:31 AM David Mertz, Ph.D. wrote: > On Tue, Dec 28, 2021 at 1:15 AM Christopher Barker > wrote: > >> On Mon, Dec 27, 2021 at 4:07 PM Steven D'Aprano >> >>> Julia (if I recall correctly) has a nice syntax for automatically >>> turning any function or method into an

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread David Mertz, Ph.D.
On Tue, Dec 28, 2021 at 1:15 AM Christopher Barker wrote: > On Mon, Dec 27, 2021 at 4:07 PM Steven D'Aprano > >> Julia (if I recall correctly) has a nice syntax for automatically >> turning any function or method into an element-wise function: > > > And numpy has an even easier one: >

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread Steven D'Aprano
On Mon, Dec 27, 2021 at 07:19:12PM -, Stefan Pochmann wrote: > Stephen J. Turnbull wrote: > > In fact you > > also created a whole new subordinate data flow that doesn't exist in > > the original (the [x+1]). I bet that a complex > > comprehension in your style will need to create a singleton

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread Steven D'Aprano
On Mon, Dec 27, 2021 at 10:15:05PM -0800, Christopher Barker wrote: > On Mon, Dec 27, 2021 at 4:07 PM Steven D'Aprano > > > Julia (if I recall correctly) has a nice syntax for automatically > > turning any function or method into an element-wise function: > > > And numpy has an even easier one:

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-12-28 Thread Stephen J. Turnbull
Steven D'Aprano writes: > I believe that Serhiy has optimized the case where a comprehension loops > over a singleton list or tuple. Yeah, I missed that. > > We are well-used to reading parenthesized expressions, though. > > Just because we're used to them doesn't make them easy to read.