pyxnat/pyxnat — pull request #44 by karchie (2013-07-17 17:42:10+00:00)
Title: add __getitem__ to CObject to support slice operator

While building some tutorials for using pyxnat with ConnectomeDB, I've been wanting to, say, take the first 10 subjects from a project. So far as I can tell, the Python idiom for this is:

cdb.select.project('HCP_Q2').subjects()[:10]

so now I've implemented __getitem__ so we can use slice notation on CObjects. This does enable some bad ideas (e.g., iterating over an integer index and accessing the contents via [i]) but, well, don't do that.