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

"None" and "pass"

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.

 \           ?If you do not trust the source do not use this program.? |
  `\                                ?Microsoft Vista security dialogue |
_o__)                                                                  |
Ben Finney