I was chatting with Peter today about some of the more annoying aspects of using jams for simple tasks. For example, to get a single onsets annotation out of the jams object, one has to do something like the following:
>>> anns = jam.search(namespace='onsets')
>>> onset = anns[0]
...
which is rather cumbersome.
I think we can shortcut this a little by providing a read-only dictionary interface to the jams object:
>>> onset = jam['onset'][0]
where the JAMS object under the hood just short-circuits the search for us:
def __getitem__(self, query):
return self.search(namespace=query)
Would this level of syntactic sugar be helpful?
I was chatting with Peter today about some of the more annoying aspects of using jams for simple tasks. For example, to get a single
onsetsannotation out of the jams object, one has to do something like the following:which is rather cumbersome.
I think we can shortcut this a little by providing a read-only dictionary interface to the jams object:
where the
JAMSobject under the hood just short-circuits the search for us:Would this level of syntactic sugar be helpful?