Jack DeVries <jdevries3...@gmail.com> added the comment:

@Jelle Zijlstra, they did think about this in the pep; see here 
https://www.python.org/dev/peps/pep-0616/#id26

The PEP authors suggested a kwarg of ``required`` which is certainly better. 
Maybe ``raise_exception`` would be even more explicit albeit verbose.

It might be a useful feature; consider the following example::

    dogs = ['mydog_spot', 'mydog_sally', 'jill']
    new_dogs = [d.removeprefix('mydog_', required=True) for d in dogs]
    
If there is support for this feature, I would like to work on it. Let me know 
what you think, and whether you think that ``required`` or ``raise_exception`` 
is a better name for the keyword argument.

----------
nosy: +jack__d

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44521>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to