[Python-ideas] Re: Support reversed(itertools.chain(x, y, z))

2021-01-09 Thread Oscar Benjamin
On Fri, 8 Jan 2021 at 22:25, Greg Ewing wrote: > > On 9/01/21 10:19 am, Ram Rachum wrote: > > In short, I want `reversed(itertools.chain(x, y, z))` that behaves like > > `itertools.chain(map(reversed, (z, y, x)))`. > > I think you mean `itertools.chain(*map(reversed, (z, y, x)))` > > You can get t

[Python-ideas] Re: Support reversed(itertools.chain(x, y, z))

2021-01-09 Thread Paul Moore
On Sat, 9 Jan 2021 at 13:29, Oscar Benjamin wrote: > The argument to reversed either needs to be a sequence with __len__ > and __getitem__ or an object with a __reversed__ method that returns > an iterator. The arguments to chain have to be iterables. Every > sequence is an iterable so there is a

[Python-ideas] Re: Add command-line option to unittest for enabling post-mortem debugging

2021-01-09 Thread Dominik Vilsmeier
In case someone is interested, I created a corresponding pull request here: https://github.com/python/cpython/pull/23900 It's a lightweight change since the relevant methods `TestCase.debug` and `TestSuite.debug` were already in place. The docstring of these methods makes it clear that this is w

[Python-ideas] Re: Support reversed(itertools.chain(x, y, z))

2021-01-09 Thread Chris Angelico
On Sun, Jan 10, 2021 at 12:29 AM Oscar Benjamin wrote: > I haven't ever wanted to reverse a chain but I have wanted to be able > to reverse an enumerate many times: > > >>> reversed(enumerate([1, 2, 3])) > ... > TypeError > > The alternative zip(range(len(obj)-1, -1, -1), reversed(obj)

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread Stephen J. Turnbull
Joseph Martinot-Lagarde writes: > One remark about this : .tar.gz files are the exception rather than > the rule, and AFAIK maybe the only one ? Not really. stem.ext -> stem.ext.zzz where zzz is a compression extension is a pretty common naming convention. For me ext == 'tar' is by far the mo

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread Chris Angelico
On Sun, Jan 10, 2021 at 4:51 AM Stephen J. Turnbull wrote: > > Joseph Martinot-Lagarde writes: > > > One remark about this : .tar.gz files are the exception rather than > > the rule, and AFAIK maybe the only one ? > > Not really. stem.ext -> stem.ext.zzz where zzz is a compression > extension i

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread 2QdxY4RzWzUUiLuE
On 2021-01-10 at 05:03:08 +1100, Chris Angelico wrote: > On Sun, Jan 10, 2021 at 4:51 AM Stephen J. Turnbull > wrote: > > > > Joseph Martinot-Lagarde writes: > > > > > One remark about this : .tar.gz files are the exception rather than > > > the rule, and AFAIK maybe the only one ? > > > > Not

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread David Mertz
On my system: % find ~ -name '*.*.*' | rev | cut -d. -f-2 | rev | sort | uniq -c | sort -nr | head -30 17278 d.ts 11314 js.map 6600 symbolic.png 4041 png.i 3968 cpython-37.pyc 2656 yarn-metadata.json 2614 yarn-tarball.tgz 2575 c.i 2526 csv.gz 1727 h.i 1659 opt-1.pyc

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread David Mertz
For my entire filesystem: 124920 cpython-38.pyc 50034 html.gz 31158 cpython-39.pyc 31032 d.ts 30415 cpython-37.pyc 21473 cpython-36.pyc 19000 js.map 9888 symbolic.png 5086 cpython-35.pyc 5004 1.gz 4657 cpython-38-x86_64-linux-gnu.so 4261 pypy36.pyc 4152 Debian.gz