Wed Jun 3 01:17:56 CDT 2009
On Jun 3, 2009, at 1:09 AM, firstname.lastname@example.org wrote:
> Given my experience with views, I would prefer to limit them to very
> local usage, e.g. views on transposed arrays don't work,
>>> m = np.matrix([1,2,3])
What case did you have in mind ?
>>> And what is the best way to check whether an array is a plain
>>> and not a subclass instance?
>> Er, why do you want to do that ?
> To get fast track for users that deliver already directly usable data,
> without special type handling. This will be more relevant for
> stats.models to handle recarrays and masked arrays, and ?
Mmh. We'll see.
> If someone gives me this decorator, I will use it, but I don't know
> how to write a decorator that works for all input and output cases,
> and doesn't screw up our documentation system.
def wrapped(*args, **kwargs):
first = args
if isinstance(first, np.ndarray):
output_type = type(first)
output_type = np.ndarray
output = func(*args, **kwargs)
if isinstance(output, np.ndarray):
wrapped.__name__ = func.__name__
wrapped.__dict__ = func.__dict__
wrapped.__doc__ = func.__doc__
More information about the Scipy-dev