On Fri, Mar 26, 2021 at 12:30:25AM +0100, Oleg Broytman <[email protected]> wrote:
> (If the answer is for me - pity it lacks any context.)
> 
> On Thu, Mar 25, 2021 at 10:51:06PM -0000, [email protected] wrote:
> > This follows the example of str.startswith/str.endswith, but yes, it could 
> > be any iterable.
> 
> It could but currently cannot. The code checks for ``tuple`` literally:
> 
>     pats = pat if isinstance(pat, tuple) else (pat,)
> 
> Ref: 
> https://github.com/python/cpython/pull/21666/files#diff-5078809c85d4fa8475e78198661cd5800368dc1e0f958b93513aac70155dd789R57
> 
> The test should be inverted - check for string, not for iterator/iterable:
> 
>     pats = (pat,) if isinstance(pat, string) else pat  # Assume ``pat`` is an 
> iterable

Sorry, ``str``, not string.

Oleg.
-- 
    Oleg Broytman            https://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/Q7A467JWTTAODWSZ3W3BIJABYWFKAHBZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to