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

2021-11-22 Thread Raimi bin Karim
> Function and method chaining. > Procedural/function syntax for chains of function calls suck. It is too > verbose (heavy on parentheses) and written backwards: > print(sort(filter(transform(merge(extract(data)), args To be honest, I think _this_ is the problem that I was trying to address,

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

2021-11-22 Thread Raimi bin Karim
Hi Steve, > Reviving old threads from a decade ago is fine, if something has > changed. Otherwise we're likely to just going to repeat the same things > that were said a decade ago. > Has anything changed in that time? The theme for previous thread

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

2021-11-22 Thread Steven D'Aprano
In my previous post, I suggested that the status quo: iter(myobj) is superior to the suggested method-based syntax: myobj.iter() I stand by that. But I will give one exception, and suggest that so long as we don't have a good syntax for that, this request will never go away for long:

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

2021-11-22 Thread Raimi bin Karim
> This would place a burden on all iterators to implement a large > and complex interface. This goes directly against the philosophy of > Python protocols, which is to be as minimal as possible. Do one thing, > and do it well. Agreed. > And where do you stop? You've picked an arbitrary subset of

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

2021-11-22 Thread Raimi bin Karim
> It's not too hard to create your own dataflow class if you want one. > It can start with any arbitrary iterable, and then have your map and > filter methods just the same. Cool trick: you can even call your class > iter! :) > class iter: > _get_iterator = iter # snapshot the original >

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

2021-11-22 Thread Steven D'Aprano
Hi Remy, On Mon, Nov 22, 2021 at 02:15:08PM -, Remy wrote: > Hi, I'd like to revive this thread after what seemed like a decade and > see where this might take us  Reviving old threads from a decade ago is fine, if something has changed. Otherwise we're likely to just going to repeat

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

2021-11-22 Thread Greg Ewing
On 23/11/21 3:15 am, Remy wrote: Iterators to implement 'transformational' functions like map, filter, flat_map, 'reductional' functions like reduce, sum, join, and 'evaluate' functions like to_list and to_set. This would place a burden on all iterators to implement a large and complex

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

2021-11-22 Thread Matt D
In your comprehension example, I'm fairly certain the filtering should be on the post incremented remainder [ x+1 for x in [1,2,3] if (x+1) % 2 == 0] I think that is the downside of the comprehension, having to repeat that twice. Maybe you can get around it with := ?? I'm stuck on 3.7 so I

[Python-ideas] Re: extending ast.parse with some lib2to3.pytree features

2021-11-22 Thread Jelle Zijlstra
El dom, 21 nov 2021 a las 14:35, Peter Ludemann () escribió: > Neil Girdhar wrote: > > I wish this had gotten more attention! :) > > I wonder what the various projects are doing to handle the latest version > of Python, if they need a parse tree with whitespace information. (The > projects I know

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

2021-11-22 Thread Chris Angelico
On Tue, Nov 23, 2021 at 1:18 AM Remy wrote: > > Hi, I'd like to revive this thread after what seemed like a decade and see > where this might take us  > > I like this idea that the OP suggested but I'd like to extend this to all > iterator objects (range_iterators, list_iterators etc.). > >

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

2021-11-22 Thread Remy
Hi, I'd like to revive this thread after what seemed like a decade and see where this might take us  I like this idea that the OP suggested but I'd like to extend this to all iterator objects (range_iterators, list_iterators etc.). Idea Iterables to expose the .__iter__() method in iterable

[Python-ideas] Re: Python Developer’s Guide chinese version

2021-11-22 Thread Stephen J. Turnbull
zhouwenbon...@mail.nwpu.edu.cn writes: > But i find that devguide has its repo in github, can i make a zh > branch in this repo? Well, you can't make a branch in *that* repo, but you can make a fork of it in your account on GitHub. That's just a couple of clicks on the GitHub page, and you

[Python-ideas] Re: Python Developer’s Guide chinese version

2021-11-22 Thread Julien Palard via Python-ideas
Hi! > I want to know does Python Developer’s Guide have chinese version, If not, i > want to do some translation, may i tell to PSF(or other people) to grant > authorization? IIRC the idea has already been raised by Stéphane Wirtel a few years back, and IIRC the conclusion was "anyway, to