Python Worst Practices

Ian Kelly ian.g.kelly at gmail.com
Fri Feb 27 17:37:18 EST 2015


On Fri, Feb 27, 2015 at 2:21 PM, Travis Griggs <travisgriggs at gmail.com> wrote:
> * Make your language have a lot of keywords. Enough to make memorizing them ALL unlikely, requiring constant visits to your documentation
> * Make sure said keywords are many of the obvious words programmers would use in their applications (map, object, bytes, dir, etc)

None of those are keywords. Keywords are these:
https://docs.python.org/3/reference/lexical_analysis.html#keywords

> * Design your syntax so that you can’t disambiguate them contextually between bind and reference

Maybe I misunderstand your complaint, but Python draws a sharp
syntactic distinction between references and assignment targets: the
latter are only ever found to the left of an = in an assignment
statement; the former are never found there. There is no reason why an
editor should be unable to tell the difference.

> * Be sure to use it in a late bound language where no warnings will be provided about the mistake you’re making at authorship time, deferring the educational experience to sundry run times

You should lint your code to get warnings about this (and many other
things) at authorship time. A good editor should also provide some
visual warning when a built-in is shadowed.



More information about the Python-list mailing list