Skip to content

Inconsistent argument name for function eval (“source” vs “expression”) #142568

@dluschan

Description

@dluschan

The function signature and parameter description correctly use the argument name source:

.. function:: eval(source, /, globals=None, locals=None)

   :param source:
      A Python expression.
   :type source: :class:`str` | :ref:`code object <code-objects>`

However, further down in the same section the text suddenly refers to the argument as “expression”:

   The *expression* argument is parsed and evaluated as a Python expression
   (technically speaking, a condition list) using the *globals* and *locals*
   mappings as global and local namespace. ...

This creates a mismatch, as there is no parameter named expression in the signature. The text should refer to the argument as source, for consistency.

Suggested fixes (choose one):

  1. Replace “The expression argument” with “The source argument” to match the function signature.
  2. Rename the function parameter from source to expression in the signature, so it matches the descriptive text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions