Changes between Initial Version and Version 1 of Ticket #28414, comment 35


Ignore:
Timestamp:
08/30/19 15:54:14 (2 years ago)
Author:
jdemeyer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28414, comment 35

    initial v1  
    44First of all, you should check whether you really need to test for "string types". Can you use duck typing instead? If for some reason, duck typing is hard, then it depends what you mean precisely with "string types".
    55
    6 Since you were mentioning filenames: `isinstance(s, (bytes, unicode))` are valid types for filenames but in Python 2 and Python 3. Note that Python 3 also has https://docs.python.org/3/library/pathlib.html, a custom class to deal specifically with filenames.
     6Since you were mentioning filenames: `isinstance(s, (bytes, unicode))` are valid types for filenames both in Python 2 and Python 3. Note that Python 3 also has https://docs.python.org/3/library/pathlib.html, a custom class to deal specifically with filenames.