Open cnbeining opened 7 years ago
Sorry but I don't understand:
SrtFile
is already an iterable __getitem__
is not to implement iteration, but for index based access of a sub element__getitem__
is already implemented by the parent class (UserList
).What am I missing?
It is quite weird that you can write something like
for i in srtfile:
But not
for k, v in enumerate(srtfile)
This quick patch will fix this problem.
2016年9月14日星期三,Jean Boussier notifications@github.com 写道:
Sorry but I don't understand:
- SrtFile is already an iterable
- getitem is not to implement iteration, but for index based access of a sub element
- getitem is already implemented by the parent class (UserList).
What am I missing?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/byroot/pysrt/pull/63#issuecomment-246924353, or mute the thread https://github.com/notifications/unsubscribe-auth/ABfRgt4eaNqJFCW4pc3n_8nwb_K_D1Tmks5qp5xagaJpZM4J8Wk4 .
You absolutely can use enumerate
:
Not sure what your problem is, but it's not this.