Python Worst Practices

Ian Kelly ian.g.kelly at gmail.com
Wed Feb 25 23:52:26 EST 2015


On Wed, Feb 25, 2015 at 1:45 PM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> http://www.slideshare.net/pydanny/python-worst-practices
>
> Any that should be added to this list?  Any that be removed as not that bad?

Using XML for configuration is a good example of a worst practice, but
using Python instead isn't best practice. There are good arguments
that a configuration language shouldn't be Turing-complete. See for
instance this blog post: http://taint.org/2011/02/18/001527a.html

The problem with XML is just that it's not very human-readable; it
doesn't need all the extra power of Python. This may be something
that's hard to appreciate until you've actually experienced an outage
because somebody checked in a configuration change that parsed and
passed tests but nonetheless was invalid due to configuration that
couldn't be evaluated until runtime. A better choice for configuration
would be something that is both easily readable and *simple* such as
JSON or YAML, or an appropriate DSL.



More information about the Python-list mailing list