From 143682ba94bf859c8bf730650e52af15addb7d00 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 10 May 2016 21:37:37 +0200 Subject: [PATCH] python/lib/aubio/__init__.py: clean up, use isinstance --- python/lib/aubio/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/lib/aubio/__init__.py b/python/lib/aubio/__init__.py index 431f7196..8e320f4b 100644 --- a/python/lib/aubio/__init__.py +++ b/python/lib/aubio/__init__.py @@ -6,10 +6,10 @@ from .midiconv import * from .slicing import * class fvec(numpy.ndarray): - """a simple numpy array holding a vector of %s""" % float_type + """a numpy vector holding audio samples""" - def __new__(self, length = 1024, **kwargs): - self.length = length - if type(length) == type([]): - return numpy.array(length, dtype = float_type, **kwargs) - return numpy.zeros(length, dtype = float_type, **kwargs) + def __new__(cls, input_arg=1024, **kwargs): + if isinstance(input_arg, int): + return numpy.zeros(input_arg, dtype=float_type, **kwargs) + else: + return numpy.array(input_arg, dtype=float_type, **kwargs) -- 2.11.0