Skip to content

[enh] Improve documentation #12

@Technologicat

Description

@Technologicat

Things that came up in a discussion with @azazel75 that could be added to the docs:

  1. A block macro gets as its argument, and is expected to return, a list of AST nodes. This is related to Block macro outputting a single-item body #7; it was surprising to a new user, because the argument is named tree, which suggests a single root node.

Currently the documentation says:

will capture the statements in the body of the with: in this case a list containing the AST for do_stuff() and return blah.

The fact that the input is (always) a list is only mentioned as part of a particular example. An easy fix is:

will capture the statements in the body of the with, as a list: in this case a list containing the AST for do_stuff() and return blah.

Should probably also be emphasized somewhere that the return value of a block macro is expected to be a list. A list, even, to guard against users such as myself that interpret the first variant as "a listy thing", and then choose a tuple because it's immutable.

(Accidentally hit the post button. Will continue in the next comment.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions