pytries / marisa-trie

Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library.
https://marisa-trie.readthedocs.io/en/latest/
MIT License
1.03k stars 91 forks source link

`Trie.load` raises a DeprecationWarning that doesn't make sense #36

Closed rspeer closed 6 years ago

rspeer commented 7 years ago

There's a nonsensical DeprecationWarning in Trie.load:

>>> import marisa_trie
>>> t = marisa_trie.Trie()
>>> t.load('data/language_names.marisa')
/home/rspeer/.virtualenvs/lum/bin/ipython:1: DeprecationWarning: Trie.save is deprecated and will be removed in marisa_trie 0.8.0. Please use Trie.load instead.
  #!/home/rspeer/.virtualenvs/lum/bin/python3.5
<marisa_trie.Trie at 0x7f4e9fefb0f0>

Some things that are wrong with this:

Expected behavior: if I use the function that the DeprecationWarning tells me I should use, I should not get a DeprecationWarning.

rspeer commented 7 years ago

As another example of a catch-22 DeprecationWarning: using Trie.save tells you "Trie.write is deprecated and will be removed in marisa_trie 0.8.0. Please use Trie.save instead.".

rspeer commented 7 years ago

Relatedly, if I use BytesTrie.load(), the warning tells me to "use Trie.load instead", which is wrong because Trie.load will not load a BytesTrie.