osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"None" and "pass"


On 06/02/18 10:23, alister via Python-list wrote:
> 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

None shall pass.

(Seriously.  I'm disappointed in all of you :-)

-- 
Rhodri James *-* Kynesim Ltd