barseghyanartur/tld

tld.get_tld_names() documented as returning iterable, but Trie object is not iterable

Closed this issue · 2 comments

I use this package in a number of places for both personal and work projects; firstly I would just like to say thank you for sharing your hard work!

get_tld_names() in previous versions returned an iterable, and is still documented as doing so. I'm not exactly sure which version it was introduced in, however, in the latest version (v0.9 at time of writing), this function returns a Trie object.

Looking through the source code, it appears that the Trie class is not implemented in a way that makes it iterable (previous implementation used a built-in set() data structure). If I have additional time I will try to provide a pull request, however, work has been leaving very little free-time lately.

Thank you again!

@neuroticnerd:

Thanks for reporting this. It's indeed incorrect (in a way, that it's still mentioned in the code comments that get_tld_names returns an iterable).

Migration to Tries was introduced a couple of versions ago. However, if you explain your use-case (with get_tld_names), I might come up with a suggestion or solution.

Update:

The get_tld_names is no longer is what it used to be. In that way, it's incompatible with old behaviour and is not supposed to used in that way. Documentation is updated.