On 12.05.16 10:54, Ethan Furman wrote: > Currently, any of these functions that already take a string have to do > a couple pointer comparisons to make sure they have a string; any of > these functions that take both a string and a bytes have to do a couple > pointer comparisons to make sure they have a string or a bytes; the > only difference if this PEP is accepted is the fall-back path when those > first checks fail. This is cheap in C, but os.path functions are implemented in Python. They have to make at least one function call (os.fspath(), hasattr() or isinstance()), not counting a bytecode for retrieving arguments, resolving attributes, comparing, jumps. Currently os.path functions use tricks to avoid overheads Yet one problem is that currently many os,path functions work with duck-typed strings (e.g. UserString). Using os.fspath() likely limit supported types to str, bytes and types that support the path protocol.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4