Skip to content

Commit

Permalink
Specify that __all__ should be a tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Jul 18, 2023
1 parent 26da579 commit 7603f98
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pybind11/how-to.rst
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ We'll use the ``continueClass`` decorator to reopen the class and add a new meth
from ._tmpl import ExampleTwo
__all__ = [] # import for side effects
__all__ = () # import for side effects
@continueClass
Expand Down Expand Up @@ -999,7 +999,7 @@ As with ``ExampleTwo``, add this to a pure-Python ``_ExampleThree.py``:

from ._tmpl import ExampleThreeI, ExampleThreeD

__all__ = ["ExampleThree"]
__all__ = ("ExampleThree", )


class ExampleThree(metaclass=TemplateMeta):
Expand Down
2 changes: 1 addition & 1 deletion python/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ Within a module, follow the order:
#. Shebang line, ``#! /usr/bin/env python`` (only for executable scripts)
#. Module-level comments (such as the `license statement <https://github.com/lsst/templates/tree/main/file_templates/stack_license_py>`__)
#. Module-level docstring
#. ``__all__ = [...]`` statement, if present
#. ``__all__ = (...)`` statement, if present
#. Imports
#. Private module variables (names start with underscore)
#. Private module functions and classes (names start with underscore)
Expand Down
2 changes: 1 addition & 1 deletion stack/module-homepage-topic-type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ You may need to exclude APIs from automodapi_ for two reasons:
2. The API includes a broken docstring, and you need to remove that API temporarily.

The main tool for removing non-public APIs from the published documentation is ``__all__``.
Each module should provide an ``__all__`` that explicitly lists the module’s public APIs.
Each module should provide an ``__all__`` tuple that explicitly lists the module’s public APIs.
`automodapi`_ respects ``__all__``.

.. _module-homepage-automodapi-skip:
Expand Down

0 comments on commit 7603f98

Please sign in to comment.