|
From: | Kenneth Loafman |
Subject: | Re: [Duplicity-talk] Path.name, Path.uc_name and Path.b_name |
Date: | Thu, 30 Nov 2017 06:35:51 -0600 |
Hello all,
I would appreciate views on the naming of the Unicode and bytes variants of a Path's filename.
Historically we have had Path.name, which has been a Python 2 string/bytes. For better Python 3 compatibility, we need to start moving towards all strings being Unicode and all bytes being bytes. As we still need to support Python 2 it is safest to keep the bytes version of the filename as well, rather than only keeping the Unicode version and converting on each use.
The three key options I see are:
- Use Path.uc_name for the Unicode version and Path.name for the bytes version, as I have done in my branch so far. Existing code does not need to change, but people may accidentally use Path.name when they want a string version of the filename.
- Globally rename Path.name to Path.b_name for the bytes version and use Path.uc_name for the Unicode version. This makes people think about which version they actually want.
- Use Path.name for the Unicode version and Path.b_name for the bytes version. This strongly encourages people to use the Unicode version (Python 3 style) unless they really need the bytes version (e.g. for a particular backend API or to access the file on disk).
I have currently gone for Option 1, as it is closest to what we are currently doing, but I think Option 2 may be most sensible if others agree.
Kind regards,
Aaron
_______________________________________________
Duplicity-talk mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/duplicity- talk
[Prev in Thread] | Current Thread | [Next in Thread] |