jmsv / ety-python

A Python module to discover the etymology of words
http://ety-python.rtfd.io
MIT License
144 stars 18 forks source link

Replace string type checking hack with six #35

Closed jmsv closed 6 years ago

jmsv commented 6 years ago

At the moment, checking a value is a string looks like this:

isinstance(word, ("".__class__, u"".__class__))

This is probably a dodgy way of doing it and since this package maintains compatibility with Python 2 and 3, it makes sense to start using six.

This would simplify string checking to:

isinstance(word, six.string_types)

From https://pythonhosted.org/six/#six.string_types:

__six.string_types__ Possible types for text data. This is basestring() in Python 2 and str in Python 3.