-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Description
I noticed that SoundFile objects always evaluate to False. For example:
wf = sf.SoundFile('input.wav')
if wf:
print("cool wav file man!")
# never executed
else:
print("no wav file...not cool.")
I don't know where this is coming from, I think by default classes inheriting from object will evaluate to True. Is this intended behavior? It's often convenient to rely on the object logically evaluating to True; for one thing builtin file objects evaluate to True so I would expect this behavior from SoundFile as well. Would you be alright with adding a bool method to return True?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels