"None" and "pass"

alister alister.ware at ntlworld.com
Tue Feb 6 05:23:26 EST 2018


On Tue, 06 Feb 2018 08:55:35 +1100, Chris Angelico wrote:

> On Tue, Feb 6, 2018 at 8:39 AM, Ben Finney <ben+python at benfinney.id.au>
> wrote:
>> Chris Angelico <rosuav at gmail.com> writes:
>>
>>> As one special case, I would accept this sort of code:
>>>
>>> def f():
>>>     ...
>>>
>>> (three dots representing the special value Ellipsis)
>>>
>>> It's a great short-hand for "stub".
>>
>> I would not accept that.
>>
>> An even better way to write a stub function is to write a docstring:
>>
>>     def frobnicate():
>>         """ Frobnicate the spangule. """
>>
>> A docstring, like any bare expression, is also a valid statement.
>> Writing a docstring can be done immediately, because if you're writing
>> a stub function you at least know the external interface of that
>> function.
>>
>>
> This is true, but I'd rather have something _under_ the docstring if
> possible, and "..." works well for that. A docstring with nothing
> underneath doesn't look like a stub - it looks like a failed edit or
> something. Having a placeholder shows that it's intentional.
> 
> ChrisA

indeed and pass was implemented for precisely this usage
why even think about possible alternatives



-- 
Use an accordion.  Go to jail.
		-- KFOG, San Francisco



More information about the Python-list mailing list