This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
python_cookbook [2016/08/22 13:21] mantis [Automatically set parameters of initializer as member variables] |
python_cookbook [2019/01/24 14:19] mantis [Logging to File] |
||
---|---|---|---|
Line 327: | Line 327: | ||
</code> | </code> | ||
- | ==== Headline ==== | + | ==== Taking care of boilerplate code ==== |
- | [[https://glyph.twistedmatrix.com/2016/08/attrs.html|attrs]] helps with | + | [[https://glyph.twistedmatrix.com/2016/08/attrs.html|attrs]] helps with boilerplate code a lot, e.g. initialisation, string representation, comparison. |
+ | |||
+ | <code python> | ||
+ | import attr | ||
+ | @attr.s | ||
+ | class Point3D(object): | ||
+ | x = attr.ib() | ||
+ | y = attr.ib() | ||
+ | z = attr.ib() | ||
+ | </code> | ||
====== CGI Scripting ====== | ====== CGI Scripting ====== | ||
===== Content Type ===== | ===== Content Type ===== | ||
Line 1136: | Line 1145: | ||
* [[http://docs.python.org/lib/module-logging.html|Logger Documentation]] | * [[http://docs.python.org/lib/module-logging.html|Logger Documentation]] | ||
- | * [[http://docs.python.org/release/2.5/lib/node422.html|Output Formatting]] | + | * [[http://docs.python.org/release/2.5/lib/node422.html|Python 2 output Formatting]] |
+ | * [[https://docs.python.org/3/howto/logging-cookbook.html|Python 3 logging cookbook]] | ||
====== Mathematics ====== | ====== Mathematics ====== |