Parentheses (as after "print")

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Sep 27 03:21:59 EDT 2017


On Wed, 27 Sep 2017 02:48:41 +0000, Stefan Ram wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:
>>"Do What I Mean" (DWIM) programming is a terrible idea.
> 
>   It's an anti-pattern, when one expects the implementation to follow
>   different and contradicting rules and then somehow guess what was in
>   the mind of the programmer.
> 
>   But it's a pattern when it means to strip the language of useless
>   boilerplate and still following consistent and simple rules. That was
>   what made Python great.


Python has never followed the DWIM anti-pattern as a philosophy.

DWIM goes against the Zen of Python:


"In the face of ambiguity, refuse the temptation to guess."


You want Python to guess that something which doesn't start with "def" 
and doesn't end with a colon is a function definition, rather than a 
class definition, or a messed up `if func(a, b)` statement, or a messed 
up `while func(a, b)` statement, or a messed up `with func(a, b)` 
statement.

No thanks.


-- 
Steven D'Aprano
“You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.” —Theo de Raadt



More information about the Python-list mailing list