# Ticket #302 (new defect)

## Usability problem: Cannot access .shape member of numpy.ndarray as tuple

Reported by: | NNemec | Owned by: | somebody |
---|---|---|---|

Priority: | major | Milestone: | wishlist |

Component: | Parsing | Keywords: | numerics |

Cc: |

### Description

On typed variable of type numpy.ndarray, the .shape member does not work

cdef numpy.ndarray var = numpy.zeros((3,)) print var.shape

gives the cython compiler error "Cannot convert 'numpy.npy_intp *' to Python object"

===================

Comment by dagss (mailing list):

This is mostly a question of semantics. shape is defined to be a C integer array for speed of var.shape[0]. How can we define a generic rule in Cython which makes both possible?

Should the behaviour of "var.shape" e.g. depend on the requested return value? This means overloading on return value which is a non-trivial language change, though perhaps appropriate here.

Thoughts welcome!

## Change History

**Note:**See TracTickets for help on using tickets.