Re: [Python-Dev] pathlib - current status of discussions

2016-04-16 Thread Nick Coghlan
On 17 April 2016 at 04:47, Chris Barker - NOAA Federal wrote: >> On Apr 13, 2016, at 8:31 PM, Nick Coghlan wrote: >> class Special(bytes): def __fspath__(self): return 'str-val' obj = Special('bytes-val', 'utf8') path_obj = fspath(obj, allow_bytes=True

Re: [Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

2016-04-16 Thread Nick Coghlan
On 16 April 2016 at 21:21, Stephen J. Turnbull wrote: > Nick Coghlan writes: > > > On 15 April 2016 at 00:52, Stephen J. Turnbull wrote: > > > Nick Coghlan writes: > > > > > > > The use case for returning bytes from __fspath__ is DirEntry, so you > > > > can write things like this in low l

Re: [Python-Dev] Wordcode: new regular bytecode using 16-bit units

2016-04-16 Thread Demur Rumed
The outstanding bug with this patch right now is a regression in line numbers causing the test for http://bugs.python.org/issue9936 to fail. I've tried to debug it without success ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/

Re: [Python-Dev] pathlib - current status of discussions

2016-04-16 Thread Chris Barker - NOAA Federal
> On Apr 13, 2016, at 8:31 PM, Nick Coghlan wrote: > >>> class Special(bytes): >>> def __fspath__(self): >>> return 'str-val' >>> obj = Special('bytes-val', 'utf8') >>> path_obj = fspath(obj, allow_bytes=True) >>> >>> With #2, path_obj == 'bytes-val'. With #3, path_obj == 'str-

Re: [Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

2016-04-16 Thread Paul Moore
On 16 April 2016 at 14:46, Stephen J. Turnbull wrote: > Paul Moore writes: [...] > > 1. I just want to pass the argument on to other functions - just do > > so, stdlib functions will work fine. > > I think this is a bad idea unless you *need* polymorphism, but OK, > it's "consenting adults". Al

Re: [Python-Dev] PEP 8 updated on whether to break before or after a binary update

2016-04-16 Thread Stephen J. Turnbull
Victor Stinner writes: > Hum. > > if (width == 0 > and height == 0 > and color == 'red' > and emphasis == 'strong' > or highlight > 100): > raise ValueError("sorry, you lose") > > Please remove one space to vertically a

Re: [Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

2016-04-16 Thread Stephen J. Turnbull
Paul Moore writes: > On 16 April 2016 at 12:21, Stephen J. Turnbull wrote: > > OK, you win, __fspath__ needs to be polymorphic. > > > > But you've just shifted me to -1 on "os.fspath": it's an attractive > > nuisance. EIBTI, applications and high-level library functions should > > use os.fs

Re: [Python-Dev] PEP 8 updated on whether to break before or after a binary update

2016-04-16 Thread francismb
Hi, On 04/15/2016 07:43 PM, Guido van Rossum wrote: > The update is already serving its real purpose: showing that style is > debatable and cannot always easily be reduced to fixed rules. > As you said, there will be always some kind personal preferences or style taste and one can see on the deb

Re: [Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

2016-04-16 Thread Paul Moore
On 16 April 2016 at 12:21, Stephen J. Turnbull wrote: > OK, you win, __fspath__ needs to be polymorphic. > > But you've just shifted me to -1 on "os.fspath": it's an attractive > nuisance. EIBTI, applications and high-level library functions should > use os.fsdecode or os.fsencode. I presume you

Re: [Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

2016-04-16 Thread Stephen J. Turnbull
Nick Coghlan writes: > On 15 April 2016 at 00:52, Stephen J. Turnbull wrote: > > Nick Coghlan writes: > > > > > The use case for returning bytes from __fspath__ is DirEntry, so you > > > can write things like this in low level code: > > > > > > def myscandir(dirpath): > > >