[Python-Dev] cpython: Rename contextlib.ignored() to contextlib.ignore().

Ethan Furman ethan at stoneleaf.us
Fri Oct 11 22:56:04 CEST 2013


On 10/11/2013 12:00 PM, MRAB wrote:
> On 11/10/2013 18:39, Ethan Furman wrote:
>> On 10/11/2013 09:43 AM, Barry Warsaw wrote:
>>> On Oct 11, 2013, at 06:27 PM, Georg Brandl wrote:
>>>
>>>> Maybe to fit in with other verb-like APIs used as context managers:
>>>> it's open() not opened().
>>>
>>> open() predates context managers, but maybe we need a new convention.
>>>
>>> with ignore(FileNotFoundError):
>>>
>>> vs
>>>
>>> with ignored(FileNotFoundError):
>>>
>>> To me anyway, the latter sounds better.
>>
>> The practice I follow is to use present tense, singular, unless there's
>> a really good reason not to.  Makes remembering a lot easier:
>>
>>     was it ignore? ignoring? ignores? ignored?
>>
>> Answer: ignore.
>>
> <pedantic>Singular would be "ignores". In this instance, "ignore" is imperative.</pedantic>

Then let's go with imperative.  ;)

--
~Ethan~


More information about the Python-Dev mailing list