I just happened to wonder whether I could, by chance, test
("FormTable", "cognatesetReference") in ds.
(NB: some of the pre-1.0-stuff we back then used in BEASTling used that kind of format for cognates, so I thought such data sets might exist elsewhere, too, but the specifics of my example are not really relevant to this discussion.)
I just happened to wonder whether I could, by chance, test
("FormTable", "cognatesetReference") in ds
.(NB: some of the pre-1.0-stuff we back then used in BEASTling used that kind of format for cognates, so I thought such data sets might exist elsewhere, too, but the specifics of my example are not really relevant to this discussion.)
That expression gets a cryptic
AttributeError: 'int' object has no attribute 'startswith'
, because as per https://docs.python.org/3.10/reference/expressions.html#membership-test-operations__contains__
falls back to testing__getitem__
for all non-negative integers in sequence, and that's completely not whathttps://github.com/cldf/pycldf/blob/384f7c5227bd467c347643bd50249c66f0559a23/src/pycldf/dataset.py#L605-L630
expects. This is quite a fringe case for pycldf, actually, so – is it worth implementing a clean
__contains__
to avoid people running into this?