[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-06 Thread David Mertz, Ph.D.
> > Earlier on the thread, I made a similar point that it would be nice to > have a way to filter without the redundant for x in x. Though I can’t think > of a really good way to express it. But as for filtered for loops: > > "for thing in > (x for x in collection if is_interesting(x))" > It's

[Python-ideas] Re: shutil.copyfileobj to return number of bytes copied

2022-03-06 Thread Steven D'Aprano
On Wed, Mar 02, 2022 at 01:08:41AM +, Davis, Matthew via Python-ideas wrote: > Hi, > > Currently shutil.copyfileobj returns nothing. > I would like to be able to find out how many bytes were copied. That seems reasonable to me. It would be a similar change to having file.write() return the

[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-06 Thread Chris Angelico
On Mon, 7 Mar 2022 at 09:33, Paul Moore wrote: > > Do I care enough to write a PEP? No. So this, like many other small ideas, > > will probably die on the vine. > > Yes, this is the real problem. It's simply not compelling enough, even > for supporters of the idea, for them to do the necessary

[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-06 Thread Paul Moore
On Sun, 6 Mar 2022 at 21:41, Christopher Barker wrote: > > >> Personally, I'm certainly not ignoring comprehensions. "for thing in >> (x for x in collection if is_interesting(x))" uses comprehensions just >> fine, if you don't like the verbosity of "x for x in", then that's an >> issue with

[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-06 Thread Christopher Barker
> Personally, I'm certainly not ignoring comprehensions. "for thing in > (x for x in collection if is_interesting(x))" uses comprehensions just > fine, if you don't like the verbosity of "x for x in", then that's an > issue with comprehensions, not a reason why comprehensions don't > address this

[Python-ideas] Re: shutil.copyfileobj to return number of bytes copied

2022-03-06 Thread Davis, Matthew via Python-ideas
Hi Barry, I can’t use os.fstat. That only applies to real files, not file-like objects. I’m using streams for downloading, unzipping, gzipping and uploading data which is larger than my disk and memory. So it’s all file-like objects, not real files. A file-like object that just passes through

[Python-ideas] Re: Proposal to associate thread-local data/context with a faulthandler traceback

2022-03-06 Thread Eric V. Smith
> On Mar 6, 2022, at 5:05 AM, Barry Scott wrote: > >  > >>> On 6 Mar 2022, at 07:19, t...@tomforb.es wrote: >>> >>> For reference, this request comes from running Dask[1] jobs. Dask handles >>> retrying and tracking tasks across machines but if you're dealing with a >>> batch of inputs

[Python-ideas] Re: Syntax proposal of for..in..if in regular for loops

2022-03-06 Thread Paul Moore
On Sun, 6 Mar 2022 at 01:55, Christopher Barker wrote: > > On Sat, Mar 5, 2022 at 4:33 AM Paul Moore wrote: >> >> for thing in filter(is_interesting, this_collection): >> ... >> >> That seems pretty non-clunky. Is the issue here that "filter" is not >> sufficiently well-known? Or that you

[Python-ideas] Re: Proposal to associate thread-local data/context with a faulthandler traceback

2022-03-06 Thread Barry Scott
> On 6 Mar 2022, at 07:19, t...@tomforb.es wrote: > > For reference, this request comes from running Dask[1] jobs. Dask handles > retrying and tracking tasks across machines but if you're dealing with a > batch of inputs that reliably kills a worker it is really hard to debug, > moreso if it

[Python-ideas] Re: Proposal to associate thread-local data/context with a faulthandler traceback

2022-03-06 Thread tom
If anyone is interested, I had a play around with this and came up with a pretty simple-ish implementation: https://github.com/orf/cpython/pull/1/files. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to