Message257277
I don’t think you need to define __len__() to get an iterable, only __getitem__().
Also, if I understand your problem, Container would also be susceptible in theory, because membership testing via “in” and “not in” falls back to iteration. If you only define __getitem__(), your class is both iterable and a container, but it is neither an Iterable nor a Container. :) |
|
Date |
User |
Action |
Args |
2016-01-01 05:34:09 | martin.panter | set | recipients:
+ martin.panter, ncoghlan, serhiy.storchaka, abarnert |
2016-01-01 05:34:09 | martin.panter | set | messageid: <1451626449.54.0.0151488220405.issue25958@psf.upfronthosting.co.za> |
2016-01-01 05:34:09 | martin.panter | link | issue25958 messages |
2016-01-01 05:34:09 | martin.panter | create | |
|