astropy/astropy — pull request #1455 by mhvk (2013-10-14 04:13:09+00:00)
Title: Array * TimeDelta fails for mysterious reason

Multiplying an `nd.array` with a `TimeDelta` fails, as the numpy function tries to get an item that does not exist (independent of whether `TimeDelta` is an array or not. It seems `TimeDelta` never gets a chance to try (the reverse -- `TimeDelta * Array` works fine); somehow, numpy fails to return `NotImplemented`? Mysterious.
```
In [1]: from astropy.time import Time, TimeDelta; import numpy as np

In [2]: np.array(1)*TimeDelta(100., format='sec')
ERROR: TypeError: scalar 'TimeDelta' object is not subscriptable. [astropy.time.core]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 np.array(1)*TimeDelta(100., format='sec')

/home/mhvk/packages/astropy/astropy/time/core.py in __getitem__(self, item)
506 if self.isscalar:
507 raise TypeError('scalar {0!r} object is not subscriptable.'.format(
--> 508 self.__class__.__name__))
509 tm = self.replicate()
510 jd1 = self._time.jd1[item]

TypeError: scalar 'TimeDelta' object is not subscriptable.
```