Hello,

On Tue, 24 Mar 2020 22:51:55 +0100
Victor Stinner <[email protected]> wrote:

> > === config.something ===
> > # If you'd like to remove some prefix from your lines, set it here
> > REMOVE_PREFIX = ""
> > ======
> >
> > === src.py ===
> > ...
> > line = line.cutprefix(config.REMOVE_PREFIX)
> > ...
> > ======  
> 
> Just use:
> 
> if config.REMOVE_PREFIX:
>     line = line.cutprefix(config.REMOVE_PREFIX)

Or even just:

if line.startswith(config.REMOVE_PREFIX):
     line = line[len(config.REMOVE_PREFIX):]

But the point taken - indeed, any confusing, inconsistent behavior can
be fixed on users' side with more if's, once they discover it.


-- 
Best regards,
 Paul                          mailto:[email protected]
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/WBPUTU2U5OC6M5GN32GOIJQQGMXLVPAC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to