
Feb. 17, 2005
2:15 p.m.
Fernando Perez wrote:
I have quite a bit of code doing things like
try: b=a.flat except: b=ravel(a)
which feels silly. It would be nice for .flat to be a guaranteed, indexable, no-copy view of the original (even if it's non-contiguous). Granted, the indexing will be costlier for a non-contiguous object, but for the external users this provides a clean API.
Why not just do b = ravel(a) ? That should work in both cases just fine. -- Robert Kern rkern@ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter