machinalis / mypy-data

mypy typesheds for the Python data stack
BSD 3-Clause "New" or "Revised" License
86 stars 23 forks source link

fix definition of ndarray.itemset #5

Open dmoisset opened 8 years ago

dmoisset commented 8 years ago

The current definition should probably use ShapeType as an index, and _S as value. To avoid the ambiguity of the 1 argument/2 argument version, an @overload definition could be better.

dmoisset commented 8 years ago

Also, I think itemset makes sense only on ndarray, not on any ArrayLike given that generic is immutable

abarto-machinalis commented 8 years ago

Although it doesn't make sense, itemset IS part of the generic interface. All it does it raise an exception, though.

dmoisset commented 8 years ago

being in the interface but always failing is essentially indistinguishable in python to not being on the interface, so I think it's a good idea to catch this statically if possible