[CentralOH] 2017-12-11 會議 Scribbles 落書/惡文?: Test Driven Development
Neil Ludban
nludban at columbus.rr.com
Tue Dec 19 09:51:44 EST 2017
On Mon, 18 Dec 2017 15:13:03 -0500
jep200404 at columbus.rr.com wrote:
...
> most readable code is. Who is the audience? A novice or Pythonista?
>
> return output or str(n)
>
Or this way may be preferred if learning modern Python:
return output if output else str(n)
https://docs.python.org/2.5/whatsnew/pep-308.html
The oddity of an apparently boolean expression evaluating to the original
value instead of a boolean has been around a while, eg:
http://www.perlmonks.org/?node_id=301355
More information about the CentralOH
mailing list