Skip to content

Commit

Permalink
simplify len()
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibe committed Feb 26, 2014
1 parent 015a62e commit 8311141
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pysoundfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,7 @@ def __getattr__(self, name):
raise AttributeError("SoundFile has no attribute %s" % name)

def __len__(self):
# strangely, the only way to see the length of a file seems to
# be to seek to the end. Returns the number of frames in the
# file.
curr = self.seek(0)
length = self.seek_absolute(-1)
self.seek_absolute(curr)
return(length)
return(self.frames)

def _get_slice_bounds(self, frame):
# get start and stop index from slice, asserting step==1
Expand Down

0 comments on commit 8311141

Please sign in to comment.