From 330e7e1b188470cae0d64b1a2ba23b9be00ab27a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 12 Mar 2015 15:15:56 +0100 Subject: [PATCH] doc/manual: add note about avoiding __del__ --- doc/manual/developing_a_ndsp.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/manual/developing_a_ndsp.rst b/doc/manual/developing_a_ndsp.rst index a22e3aabd..734df6f9e 100644 --- a/doc/manual/developing_a_ndsp.rst +++ b/doc/manual/developing_a_ndsp.rst @@ -172,6 +172,7 @@ The program below exemplifies how to use logging: :: General guidelines ------------------ +* Do not use ``__del__`` to implement the cleanup code of your driver. Instead, define a ``close`` method, and call it using a ``try...finally...`` block in the controller. * Format your source code according to PEP8. We suggest using ``flake8`` to check for compliance. * Use new-style formatting (``str.format``) except for logging where it is not well supported, and double quotes for strings. * The device identification (e.g. serial number) to attach to must be passed as a command-line parameter to the controller. We suggest using ``-s`` and ``--serial`` as parameter name.