astropy/astropy — pull request #1731 by mhvk (2013-11-02 20:45:18+00:00)
Title: Memoize parameter-less equivalencies, so they are re-used and can be compared

For specutils, the question arose whether it was possible to test whether a given list of equivalencies included `u.spectral()`. Currently, such a test is not directly feasible, since every call to `u.spectral()` returns a list with newly created `lambda` functions. As this seemed generally a bit wasteful, this PR memoized the output of the argument-less equivalency functions. I'll add tests if people think this is a good approach (assuming it is even considered a worthy pursuit).

In any case, with this,
```
In [1]: import astropy.units as u
In [2]: set(u.spectral()) <= set(u.doppler_radio(12.*u.GHz)+u.spectral())
Out[2]: True
```