aiodns icon indicating copy to clipboard operation
aiodns copied to clipboard

Not namedtuple-like?

Open Dreamsorcerer opened this issue 6 months ago • 2 comments

The README says:

results are always namedtuple-like objects

If I try to do a[0] or val, ttl = a an Exception occurs. It would appear these objects are not like tuples. We should probably reword this part of the documentation...

Dreamsorcerer avatar Jul 09 '25 14:07 Dreamsorcerer

Or, if we wanted to make them namedtuple, it could allow some flexibility.

I was attempting to get the result of A, AAAA, and TXT together, with: for val, _ttl in results

If I need to use attributes, then I need to special case the TXT result, as it uses a different attribute name.

Dreamsorcerer avatar Jul 09 '25 14:07 Dreamsorcerer

IMHO it'd be better to fix the docs and not say that. A dataclass-style object makes more sense.

saghul avatar Aug 04 '25 07:08 saghul