[SciPy-user] sequence emulation -/-> array access?

Alan G Isaac aisaac at american.edu
Fri Dec 16 09:40:55 CST 2005


Is a special array interface necessary for scipy.array
to access even simple sequence emulators?

E.g., suppose I have

>>> class simple:
...  def __init__(self,data):
...   self.data = data
...
where it is enforced that data is a list,
and to class this I add sequence emulation
http://docs.python.org/ref/sequence-types.html

Can someone please point me to a *minimal* example
where I can then do
x = simple([1,2,3])
y = scipy.array(x)
and end up with an array of the list values
(just like when you do scipy.array([1,2,3])).

Thank you,
Alan Isaac






More information about the SciPy-user mailing list