A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-April/143675.html below:

[Python-Dev] When should pathlib stop being provisional?

[Python-Dev] When should pathlib stop being provisional?Nick Coghlan ncoghlan at gmail.com
Wed Apr 6 02:29:34 EDT 2016
On 6 April 2016 at 15:57, Serhiy Storchaka <storchaka at gmail.com> wrote:
> On 06.04.16 05:44, Nick Coghlan wrote:
>>
>> The most promising option for that is probably "getattr(path, 'path',
>> path)", since the "path" attribute is being added to pathlib, and the
>> given idiom can be readily adopted in Python 2/3 compatible code
>> (since normal strings and any other object without a "path" attribute
>> are passed through unchanged). Alternatively, since it's a protocol,
>> double-underscores on the property name may be appropriate (i.e.
>> "getattr(path, '__path__', path)")
>
> This was already discussed. Current conclusion is using the "path"
> attribute. See http://bugs.python.org/issue22570 .

I'd missed the existing precedent in DirEntry.path, so simply taking
that and running with it sounds good to me.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

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