Improved __repr__/__str__ for Analyzer/Generator/Translator
Opened this issue · 4 comments
sushain97 commented
I'm not sure what they are now but they're probably not too helpful
orgh0 commented
In [1]: import apertium
In [2]: a = apertium.Analyzer('en')
In [3]: a
Out[3]: Analyzer(mode=eng-morph, lang=eng)
Is the structure okay ?
sushain97 commented
Ideally, __repr__
would recreate the class. So, repr(a) == "Analyzer(lang='eng')"
and str(a) == "<Analyzer: eng-morph>"
seems nice.
orgh0 commented
@sushain97 what about for the Translator
module?
I don't have mode there.
we just parse mode files in that module.
What should the __str__()
have?
sushain97 commented
There is a mode. It's something like spa-cat_valencia. The fact that we're parsing a mode implies there is one.