Closed majidaldo closed 4 months ago
Interesting, sure, I guess I could see a custom enter
if you were trying to traverse iterables which default_enter
doesn't support.
Just looking at this, I think I would change research
to use visit
instead of enter
and then allow a custom enter
to be passed. But I don't think there's much value to a custom visit
or exit
, can you think of any?
Interesting, sure, I guess I could see a custom
enter
if you were trying to traverse iterables whichdefault_enter
doesn't support.Just looking at this, I think I would change
research
to usevisit
instead ofenter
and then allow a customenter
to be passed. But I don't think there's much value to a customvisit
orexit
, can you think of any?
Didn't understand "and then allow a custom enter
to be passed". The case that I had in mind, is when the object at the root is 'custom'... you need a way to compose/decompose.
from types import SimpleNamespace as NS
NS(
a='a',
b='b',
c=NS(aa='aa') )
@majidaldo just pushed a PR (#372) that I think is closer to what you might have expected. check out the test to see it in action with SimpleNamespace.
https://github.com/mahmoud/boltons/blob/6a363e6c4837a2cca606eba5903ea6f4ae83d745/boltons/iterutils.py#L1355
for the case where you have you custom
enter
.