
On Tue, Oct 1, 2024 at 9:57 AM Evgeni Burovski via NumPy-Discussion < numpy-discussion@python.org> wrote:
I like this, too.
And I think the trailing comment, # shape=... is much better, as it gets the best of both worlds: user get the info, and tools which do eval(repr(..)) only need to learn to ignore the comment. For one, numpy's own doctests will keep working with no churn since scipy_doctest handles this already.
Given that we've already chosen to use the fake `shape=...` keyword when there is a 0-length axis, what do you think we should do, consistency-wise?
np.empty([10, 0]) array([], shape=(10, 0), dtype=float64)
1. Follow the precedent and use the fake `shape=...` keyword in the summarized-array case. 2. Ignore the precedent and use a following `# shape=...` comment afterwards in the summarized-array case and leave the 0-length-axis case alone. 3. Fix the 0-length-axis case to use the following `# shape=...` comment too. -- Robert Kern