Old Man Yells At Cloud

Chris Angelico rosuav at gmail.com
Tue Sep 19 13:54:51 EDT 2017


On Wed, Sep 20, 2017 at 3:44 AM, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Steve D'Aprano <steve+python at pearwood.info> did *not* write
> [it was edited/abbreviated by me - S. R.]:
> |disadvantages:
> |0 - it makes print a special thing
> |1 - beginners have to unlearn
> |2 - `print(x, y)` is *not* the same as `print x, y`;
> |3 - it has bizarre syntax that nobody would find normal
> |4 - you can't pass keyword arguments
> |5 - it can't be mocked, shadowed, monkey-patched or replaced for testing;
> |6 - and you can't even write help(print) in the interactive interpreter
>
>   But a simple "autocorrect" features that adds missing
>   parentheses when the case is clear and obvious would not
>   suffer from most of those drawbacks, except maybe from #2.

Such a feature is also useful for other functions - nothing special
about print there. And you can go way further; I've seen people with
their editors configured so that typing "def" prepopulates an entire
function skeleton, complete with a docstring template. That's an
editor feature that can save you typing; but the *code* still has all
the parentheses in it.

ChrisA



More information about the Python-list mailing list