I missed the point of your question, my answer was about False
replacement as I hadn't precised it previously.
So now that I understand your question, yes you're right there's an issue here.
This pleads in the direction of two new methods: prefix() and suffix().
As PEP 616 just added the two new
Excuse me, I wrote this answer from the web interface.
Florent
Le lun. 9 août 2021 à 16:16, Chris Angelico a écrit :
>
> On Tue, Aug 10, 2021 at 12:08 AM wrote:
> >
> > Two possibilities:
> >
> > 1) the perfectly backward compatible, retrun False
> > 2) the more pythonic, return the empty value
I was just saying that using the bool return value as an index is a bit
obscure, compared to using it as a condition in an if statement. But even
in the more common use, returning the matched string is still a chance in
behavior.
On Mon, Aug 9, 2021, 10:13 AM Chris Angelico wrote:
> On Tue, Aug
09.08.21 17:05, fgalla...@gmail.com пише:
> Two possibilities:
>
> 1) the perfectly backward compatible, retrun False
> 2) the more pythonic, return the empty value of the object (i.e. "" for str)
The problem is that for backward compatibility it should return True.
And empty string's boolean val
On Tue, Aug 10, 2021 at 12:08 AM wrote:
>
> Two possibilities:
>
> 1) the perfectly backward compatible, retrun False
> 2) the more pythonic, return the empty value of the object (i.e. "" for str)
Please quote the person you're responding to, for context. Were you
replying to Serhiy?
ChrisA
On Tue, Aug 10, 2021 at 12:03 AM Simão Afonso
wrote:
>
> On 2021-08-09 23:57:42, Chris Angelico wrote:
> > On Mon, Aug 9, 2021 at 10:32 PM Samuel Freilich
> > wrote:
> > > Even without it being used in as complicated a way as that it's still not
> > > backward compatible because of the trivial
Two possibilities:
1) the perfectly backward compatible, retrun False
2) the more pythonic, return the empty value of the object (i.e. "" for str)
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...
On 2021-08-09 23:57:42, Chris Angelico wrote:
> On Mon, Aug 9, 2021 at 10:32 PM Samuel Freilich wrote:
> > Even without it being used in as complicated a way as that it's still not
> > backward compatible because of the trivial case, as foo.endswith("") is
> > True.
>
> I was talking specifical
On Mon, Aug 9, 2021 at 10:32 PM Samuel Freilich wrote:
>
> > that can be used (eg) for indexing
>
> Even without it being used in as complicated a way as that it's still not
> backward compatible because of the trivial case, as foo.endswith("") is True.
>
I was talking specifically about the ori
> that can be used (eg) for indexing
Even without it being used in as complicated a way as that it's *still* not
backward compatible because of the trivial case, as foo.endswith("") is
True.
On Sun, Aug 8, 2021 at 11:55 PM Chris Angelico wrote:
> On Mon, Aug 9, 2021 at 1:42 PM wrote:
> >
> > T
09.08.21 05:05, fgalla...@gmail.com пише:
> This is a proposal to change the behaviour of the startswith() and
> endswith() methods for str, bytes and bytearray objects, making them
> return the matched value instead of the True boolean.
And what should it return for empty matched value?
On Mon, Aug 9, 2021 at 1:42 PM wrote:
>
> This is a proposal to change the behaviour of the startswith() and
> endswith() methods for str, bytes and bytearray objects, making them
> return the matched value instead of the True boolean.
Unfortunately this would break backward compatibility, since
12 matches
Mail list logo