History

python/lib/aubio/__init__.py: clean up, use isinstance

Paul Brossier committed 10 years ago

Commit 143682b1 parent 016813e1 file · +6 −6Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/lib/aubio/__init__.py+6−6
@@ -6,10 +6,10 @@ from .midiconv import * · 5 unmodified lines
66 from .slicing import *
77
88 class fvec(numpy.ndarray):
9− """a simple numpy array holding a vector of %s""" % float_type
9+ """a numpy vector holding audio samples"""
1010
11− def __new__(self, length = 1024, **kwargs):
12− self.length = length
13− if type(length) == type([]):
14− return numpy.array(length, dtype = float_type, **kwargs)
15− return numpy.zeros(length, dtype = float_type, **kwargs)
11+ def __new__(cls, input_arg=1024, **kwargs):
12+ if isinstance(input_arg, int):
13+ return numpy.zeros(input_arg, dtype=float_type, **kwargs)
14+ else:
15+ return numpy.array(input_arg, dtype=float_type, **kwargs)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t