Changes between Initial Version and Version 1 of Ticket #28414, comment 35
- Timestamp:
- 08/30/19 15:54:14 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28414, comment 35
initial v1 4 4 First 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". 5 5 6 Since you were mentioning filenames: `isinstance(s, (bytes, unicode))` are valid types for filenames b utin 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.6 Since 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.