European-XFEL / EXtra-data

Access saved EuXFEL data
https://extra-data.rtfd.io
BSD 3-Clause "New" or "Revised" License
7 stars 14 forks source link

Prevent iteration over a KeyData object #519

Closed takluyver closed 6 months ago

takluyver commented 6 months ago

By adding __getitem__ we accidentally made KeyData iterable. And in fact it behaved as an infinite iterable, so simply calling list(kd) could go into an infinite loop. I ran into this by making a mistake in a DAMNIT context file.

I can imagine we might want it to be iterable at some point, maybe yielding train IDs or data like .trains(). But for now, avoiding the infinite loop seems like a useful step.

tmichela commented 6 months ago

LGTM

takluyver commented 6 months ago

Thanks :slightly_smiling_face: