Skip to content

Commit

Permalink
DOC: add faq and fix a typo in Operator
Browse files Browse the repository at this point in the history
  • Loading branch information
kohr-h committed Nov 19, 2015
1 parent e48ca41 commit 5fe6d3a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
28 changes: 28 additions & 0 deletions 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
<https://docs.python.org/2/library/functions.html#super>`_ has to
be called with a type as first argument, whereas
`in Python 3
<https://docs.python.org/3/library/functions.html#super>`_, 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.
15 changes: 10 additions & 5 deletions doc/source/index.rst
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion odl/operator/operator.py
Expand Up @@ -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
Expand Down

0 comments on commit 5fe6d3a

Please sign in to comment.