[Python-ideas] Re: Allow star unpacking within an slice expression

2020-03-06 Thread Serhiy Storchaka
06.03.20 18:30, Neil Girdhar пише: Reviving this old thread since this is hitting me again today.  Is there any momentum on extending tuple unpacking to within slices? It does not supported by AST. But with issue34822 changes it could be implemented. https://bugs.python.org/issue34822

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Ethan Furman
On 03/06/2020 04:03 PM, Steven D'Aprano wrote: On Thu, Mar 05, 2020 at 12:45:28PM -0800, Andrew Barnert via Python-ideas wrote: Well, I like the idea if someone can come up with a good naming scheme—something that at least reminds me which function is the “set of chars” stripper and which the

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Guido van Rossum
On Fri, Mar 6, 2020 at 5:46 PM Christopher Barker wrote: > > (Since bytes may be used for file names I think they should get this new > capability too.) > > I don’t really care one way or another, but is it really still the case > that bytes need to be used for filenames? For uses other than

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Christopher Barker
(Since bytes may be used for file names I think they should get this new capability too.) I don’t really care one way or another, but is it really still the case that bytes need to be used for filenames? For uses other than just passing them around? Sigh. In any case, while it’s fine to

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Ethan Furman
On 03/06/2020 04:07 PM, Steven D'Aprano wrote: On Fri, Mar 06, 2020 at 03:33:49PM -0800, Ethan Furman wrote: I think we should have a `stripstr()` as an alias for strip, and a new `stripchr()`. Shouldn't they be the other way around? `strip` removes chars from a set of chars; the proposed

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Guido van Rossum
This will only need a PEP if the eventual proposal is controversial. :-) Someone (Andrew Barnert?) has claimed that another name, like cut or trim, would be too confusing. I’m not sure I agree. I think strip_prefix is more confusing, and stripstr or strstrip would unnecessarily cut off the option

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Steven D'Aprano
On Fri, Mar 06, 2020 at 03:33:49PM -0800, Ethan Furman wrote: > I think we should have a `stripstr()` as an alias for strip, and a new > `stripchr()`. Shouldn't they be the other way around? `strip` removes chars from a set of chars; the proposed method will remove a prefix/suffix. > And

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Steven D'Aprano
On Thu, Mar 05, 2020 at 12:45:28PM -0800, Andrew Barnert via Python-ideas wrote: > Well, I like the idea if someone can come up with a good naming > scheme—something that at least reminds me which function is the “set > of chars” stripper and which the “substring” stripper, You've been a

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Ethan Furman
On 03/06/2020 02:59 PM, Guido van Rossum wrote: On Fri, Mar 6, 2020 at 2:19 PM Steven D'Aprano wrote: Can we just fix this? Obviously there will be a month of bike-shedding arguments about the names *wink* but can we at least agree that this is a genuine source of confusion and a useful

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Guido van Rossum
Yes. On Fri, Mar 6, 2020 at 2:19 PM Steven D'Aprano wrote: > Can we just fix this? The lack of an obvious way to delete a prefix or > suffix is a continual pain point for users of the language. We've just > had yet another bug report from some poor user who misunderstood the > lstrip method: >

[Python-ideas] Re: New explicit methods to trim strings

2020-03-06 Thread Steven D'Aprano
Can we just fix this? The lack of an obvious way to delete a prefix or suffix is a continual pain point for users of the language. We've just had yet another bug report from some poor user who misunderstood the lstrip method: https://bugs.python.org/issue39880 More examples:

[Python-ideas] Re: More descriptive error message than "too many values to unpack"

2020-03-06 Thread Matthias Bussonnier
> > > In general Python error messages don't include the relevant values or much > information about them, although I often wish they would. For example when I > get a KeyError I wish I could see which keys are present, unless there's too > many for it to be practical. I'm speculating, but I

[Python-ideas] Re: Allow star unpacking within an slice expression

2020-03-06 Thread Neil Girdhar
Reviving this old thread since this is hitting me again today. Is there any momentum on extending tuple unpacking to within slices? On Thursday, December 21, 2017 at 4:33:07 PM UTC-5, Neil Girdhar wrote: > > I didn't think of this when we were discussing 448. I ran into this > today, so I

[Python-ideas] Re: More descriptive error message than "too many values to unpack"

2020-03-06 Thread Neil Girdhar
I also would prefer richer exceptions especially if it can be done without introducing any other problems. In the same vein, I once suggested a richer inheritance failure message (this, basically: https://github.com/NeilGirdhar/inheritance_graph), for which if I remember correctly Guido was

[Python-ideas] Re: CSV Dictwriter - Handling escape characters

2020-03-06 Thread Guido van Rossum
EVERYONE, please don’t follow up on the meta discussion. What’s said is said. But this type of discussion never leads to anything useful, and often causes more bad blood. (Chris, next time I think it would be better if you sat on your hands. And ditto for everyone else who thinks to respond to an