Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kesmit13
Copy link

The numpy example parsing didn't seem to work the way numpy examples are formatted in the real-world. The assumption is that they look like this:

Examples
-----------
>>> print('hi')        <== code snippet
hi                            <== description

However, the correct interpretation is:

Examples
-----------
>>> print('hi')          <== code snippet
hi                              <== output of code snippet

If descriptions are used, they go before the snippet:

Examples
----------
Print the word 'hi':

>>> print('hi')
hi

It is also possible to have continuation marks after the initial Python prompt:

Examples
-----------
Print the word 'hi' 5 times:

>>> for i in range(5):
...    print('hi')
hi
hi
hi
hi
hi

The code in this PR changes the way that numpy examples are parsed to allow for these changes, so it is a breaking change.

@rr-
Copy link
Owner

rr- commented Aug 22, 2025

Thank you for the PR. A couple of notes:

  • Can we update the tests to cover the added functionality?
  • Let's update the changelog to include this change.
  • Let's rebase with the newest changes and fix the styling issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants