Ian Pilcher wrote at 2022-11-11 15:29 -0600: > ... >In searching, I've found a few articles that discuss the fact that >classmethod objects aren't callable, but the situation actually seems to >be more complicated. > > >>> type(DuidLLT._parse_l2addr) ><class 'method'> > >>> callable(DuidLLT._parse_l2addr) >True > >The method itself is callable, which makes sense. The factory function >doesn't access it directly, however, it gets it out of the _attrs >dictionary. > > >>> type(DuidLLT._attrs['layer2_addr']) ><class 'classmethod'> > >>> callable(DuidLLT._attrs['layer2_addr']) >False
Accessing an object via a `dict` does not change its type, nor does putting it into a `dict`. Thus, you did not put `DuidLLT._parse_l2addr` (of type `method`) into your `_attrs` `dict` but something else (of type `classmethod`). This narrows down the space for your investigation: why was the object you have put into `_attr` was not what you have expected. -- https://mail.python.org/mailman/listinfo/python-list