#๐Ÿ”’ How do you usually document attributes typed as NDArray

7 messages ยท Page 1 of 1 (latest)

vernal hornet
#

When you have methods that return NDArray, how do you document it?
Is it possible to type-hint or document the type of the array? as containing np.float64 for example.
And how to document what each axis is? and for the last axis what are the values?

For example if I have a 2D array of vertices, how to document that? to indicate that the first axis is the vertex index, and the second axis is the x and y of the vertex. And the array being a float one.

clever trailBOT
#

@vernal hornet

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

surreal oar
#

currently, just use the array dtype, like:

def my_function(array: NDArray[np.float64]) -> NDArray[np.uint8]:
    pass

there's work being done to add the shape of an array to its type, but it's not completed

vernal hornet
#

Thanks a bunch!

clever trailBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ How do you usually document attributes typed as NDArray