Skip to content

Mkdocstrings use - Allow printing other object than str #7

@hameye

Description

@hameye

Hi, first thanks for this package and the mkdocstrings suite in general !

Is your feature request related to a problem? Please describe.
Executing code that is supposed to output numpy array does not work.

Describe the solution you'd like
To be allowed to output other kind of objects than str.

Describe alternatives you've considered
I tried converting objects to str as a workaround, but the rendering is not satisfying enough and writing print(str(obj)) in the python code is a bit misleading for future reader of the documentation

Additional context
Code

import numpy as np

xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])

print(xyz)

Result in documentation :

TypeError: sequence item 0: expected str instance, numpy.ndarray found

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions