From 5fe6d3a1d9776b192ef6ffefb6d2fe3aebf12b53 Mon Sep 17 00:00:00 2001 From: Holger Kohr Date: Thu, 19 Nov 2015 10:22:25 +0100 Subject: [PATCH] DOC: add faq and fix a typo in Operator --- doc/source/guide/faq.rst | 28 ++++++++++++++++++++++++++++ doc/source/index.rst | 15 ++++++++++----- odl/operator/operator.py | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 doc/source/guide/faq.rst diff --git a/doc/source/guide/faq.rst b/doc/source/guide/faq.rst new file mode 100644 index 00000000000..e8a2d2a5846 --- /dev/null +++ b/doc/source/guide/faq.rst @@ -0,0 +1,28 @@ +########################### +Answers to common questions +########################### + +Abbreviations: **Q** uestion -- **P** roblem -- **S** olution + +Errors related to Python 2/3 +---------------------------- + +#. **Q:** I follow your recommendation to call ``super().__init__(dom, ran)`` + in the ``__init__()`` method of my ``MyOperator``, but I get the following + error:: + + File <...>, line ..., in __init__ + super().__init__(dom, ran) + + TypeError: super() takes at least 1 argument (0 given) + + **P:** The ``super()`` function `in Python 2 + `_ has to + be called with a type as first argument, whereas + `in Python 3 + `_, the + type argument is optional and usually not needed. + + **S:** We recommend to include ``from builtins import super`` in your + module to backport the new Py3 ``super()`` function. This way, your code + will run in both Python 2 and 3. diff --git a/doc/source/index.rst b/doc/source/index.rst index 3912c2b3416..0fe436ec9bf 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -8,22 +8,27 @@ The main intent of ODL is to enable mathematicians and applied scientists to use Working with ODL ---------------- -User -~~~~ +As a user +~~~~~~~~~ :doc:`guide/guide` -Developer -~~~~~~~~~ +As a developer +~~~~~~~~~~~~~~ :doc:`dev/dev` +Answers to common questions +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:doc:`guide/faq` + Contents ======== .. toctree:: :maxdepth: 3 - + guide/guide dev/dev odl diff --git a/odl/operator/operator.py b/odl/operator/operator.py index 916ea5f43ab..e511d7b90a8 100644 --- a/odl/operator/operator.py +++ b/odl/operator/operator.py @@ -153,7 +153,7 @@ class Operator(with_metaclass(_OperatorMeta, object)): The set this operator maps to It is **highly** recommended to call - ``super().__init__(doma, ran)`` (Note: + ``super().__init__(dom, ran)`` (Note: add ``from builtins import super`` in Python 2) in the ``__init__()`` method of any subclass, where ``dom`` and ``ran`` are the arguments specifying domain and range of the new