On Wed, Apr 13, 2016 at 11:09 AM, Ethan Furman <et...@stoneleaf.us> wrote: > - a single os.fspath() with an allow_bytes parameter > (mostly True in os and os.path, mostly False everywhere > else)
-0 > - a str-only os.fspathname() and a str/bytes os.fspath() +1 on using separate functions. > I'm partial to the first choice as it is simplicity itself to know when > looking at it if bytes might be coming back by the presence or absence of a > second argument to the call; otherwise one has to keep straight in one's > head which is str-only and which might allow bytes (I'm not very good at > keeping similar sounding functions separate -- what's the difference between > shutil.copy and shutil.copy2? I have to look it up every time). I do the same, but... this is one of those cases where a caller will usually be passing a constant directly. If passed as a positional argument, it'll just be confusing ("what's True?" is my usual reaction to a Boolean positional argument). If passed as a keyword argument with a descriptive name, it'll be longer than I'd like to see: path_str = os.fspath(path, allow_bytes=True) Names like os.fspath() and os.fssyspath() seem good to me. -Fred -- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com