Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Chris Jerdonek
On Wed, Mar 28, 2018 at 6:15 PM, Nathaniel Smith wrote: > On Wed, Mar 28, 2018 at 1:03 PM, Serhiy Storchaka wrote: >> 28.03.18 21:39, Antoine Pitrou пише: >>> I'd like to submit this PEP for discussion. It is quite specialized >>> and the main target audience of the proposed changes is >>> users

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Nathaniel Smith
On Thu, Mar 29, 2018 at 12:56 AM, Chris Jerdonek wrote: > On Wed, Mar 28, 2018 at 6:15 PM, Nathaniel Smith wrote: >> On Wed, Mar 28, 2018 at 1:03 PM, Serhiy Storchaka >> wrote: >>> 28.03.18 21:39, Antoine Pitrou пише: I'd like to submit this PEP for discussion. It is quite specialized >>>

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Antoine Pitrou
On Thu, 29 Mar 2018 01:40:17 + Robert Collins wrote: > > > > Data sharing > > > > > > If you pickle and then unpickle an object in the same process, passing > > out-of-band buffer views, then the unpickled object may be backed by the > > same buffer as the original pickled object.

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Chris Angelico
On Thu, Mar 29, 2018 at 7:18 PM, Nathaniel Smith wrote: > Another example is the multiprocessing module: it's very safe to > assume that the parent and the child are using the same interpreter > :-). There's no fundamental reason you shouldn't be able to send > bytecode between them. You put a sm

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Paul Moore
On 29 March 2018 at 09:49, Chris Angelico wrote: > On Thu, Mar 29, 2018 at 7:18 PM, Nathaniel Smith wrote: >> Another example is the multiprocessing module: it's very safe to >> assume that the parent and the child are using the same interpreter >> :-). There's no fundamental reason you shouldn't

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Chris Angelico
On Thu, Mar 29, 2018 at 7:56 PM, Paul Moore wrote: > On 29 March 2018 at 09:49, Chris Angelico wrote: >> On Thu, Mar 29, 2018 at 7:18 PM, Nathaniel Smith wrote: >>> Another example is the multiprocessing module: it's very safe to >>> assume that the parent and the child are using the same interp

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Jeff Allen
My credentials for this are that I re-worked str.format in Jython quite extensively, and I followed the design of f-strings a bit when they were introduced, but I haven't used them to write anything. On 29/03/2018 00:48, Tim Peters wrote: [Tim Delaney ] ... I also assumed (not having actually

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Nathaniel Smith
On Thu, Mar 29, 2018, 02:02 Chris Angelico wrote: > On Thu, Mar 29, 2018 at 7:56 PM, Paul Moore wrote: > > On 29 March 2018 at 09:49, Chris Angelico wrote: > >> On Thu, Mar 29, 2018 at 7:18 PM, Nathaniel Smith wrote: > >>> Another example is the multiprocessing module: it's very safe to > >>>

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Eric V. Smith
On 3/29/2018 6:17 AM, Jeff Allen wrote: My credentials for this are that I re-worked str.format in Jython quite extensively, and I followed the design of f-strings a bit when they were introduced, but I haven't used them to write anything. Thanks for your work on Jython. And hop on the f-strin

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Steven D'Aprano
On Wed, Mar 28, 2018 at 06:27:19PM +0300, Serhiy Storchaka wrote: > The optimizer already changes > semantic. Non-optimized "if a and True:" would call bool(a) twice, but > optimized code calls it only once. I don't understand this. Why would bool(a) be called twice, and when did this change?

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Chris Angelico
On Thu, Mar 29, 2018 at 11:28 PM, Steven D'Aprano wrote: > On Wed, Mar 28, 2018 at 06:27:19PM +0300, Serhiy Storchaka wrote: > >> The optimizer already changes >> semantic. Non-optimized "if a and True:" would call bool(a) twice, but >> optimized code calls it only once. > > I don't understand thi

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Chris Angelico
On Fri, Mar 30, 2018 at 1:08 AM, Chris Angelico wrote: > On Thu, Mar 29, 2018 at 11:28 PM, Steven D'Aprano wrote: >> On Wed, Mar 28, 2018 at 06:27:19PM +0300, Serhiy Storchaka wrote: >> >>> The optimizer already changes >>> semantic. Non-optimized "if a and True:" would call bool(a) twice, but >>

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Antoine Pitrou
On Thu, 29 Mar 2018 11:25:13 + Nathaniel Smith wrote: > > > I doubt it'll be a problem to pickle though as it'll use some form of > > versioning even in NONPORTABLE mode right? > > > > I guess the (merged, but undocumented?) changes in > https://bugs.python.org/issue28053 should make it po

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Terry Reedy
On 3/28/2018 11:27 AM, Serhiy Storchaka wrote: The optimizer already changes semantic. Non-optimized "if a and True:" would call bool(a) twice, but optimized code calls it only once. Perhaps Ref 3.3.1 object.__bool__ entry, after " should return False or True.", should say something like "Sho

Re: [Python-Dev] Sets, Dictionaries

2018-03-29 Thread Stephen Hansen
On Wed, Mar 28, 2018, at 9:14 PM, Julia Kim wrote: > My suggestion is to change the syntax for creating an empty set and an > empty dictionary as following. > > an_empty_set = {} > an_empty_dictionary = {:} > > It would seem to make more sense. The amount of code this would break is astronomica

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Nick Coghlan
On 29 March 2018 at 04:39, Antoine Pitrou wrote: > > Hi, > > I'd like to submit this PEP for discussion. It is quite specialized > and the main target audience of the proposed changes is > users and authors of applications/libraries transferring large amounts > of data (read: the scientific compu

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Nick Coghlan
On 29 March 2018 at 21:50, Eric V. Smith wrote: > #1 seems so complex as to not be worth it, given the likely small overall > impact of the optimization to a large program. If the speedup really is > sufficiently important for a particular piece of code, I'd suggest just > rewriting the code to us

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Eric V. Smith
On 3/29/2018 12:13 PM, Nick Coghlan wrote: On 29 March 2018 at 21:50, Eric V. Smith wrote: #1 seems so complex as to not be worth it, given the likely small overall impact of the optimization to a large program. If the speedup really is sufficiently important for a particular piece of code, I'd

Re: [Python-Dev] Sets, Dictionaries

2018-03-29 Thread David Mertz
I agree with everything Steven says. But it's true that even as a 20-year Python user, this is an error I make moderately often when I want an empty set... Notwithstanding that I typed it thousands of times before sets even existed (and still type it when I want an empty dictionary). That said, I'

Re: [Python-Dev] PEP 574 -- Pickle protocol 5 with out-of-band data

2018-03-29 Thread Serhiy Storchaka
28.03.18 23:19, Antoine Pitrou пише: Agreed. Do you know by which timeframe you'll know which opcodes you want to add? I'm currently in the middle of the first part, trying to implement pickling local classes with static and class methods without creating loops. Other parts exist just like g

Re: [Python-Dev] Sets, Dictionaries

2018-03-29 Thread Eric Fahlgren
On Thu, Mar 29, 2018 at 10:11 AM, David Mertz wrote: > I agree with everything Steven says. But it's true that even as a 20-year > Python user, this is an error I make moderately often when I want an empty > set... Notwithstanding that I typed it thousands of times before sets even > existed (and

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Serhiy Storchaka
29.03.18 13:17, Jeff Allen пише:     '{1} {0}'.format(a(), b()) # E1     f'{b()}{a()}' # E2 I think I would be very surprised to find b called before a in E1 because of the general contract on the meaning of method calls. I'm assuming that's what an AST-based optimisation woul

Re: [Python-Dev] Move ensurepip blobs to external place

2018-03-29 Thread Donald Stufft
From my POV I don’t care where they live, just document how to update them going forward. Sent from my iPhone > On Mar 24, 2018, at 4:50 AM, Serhiy Storchaka wrote: > > Wouldn't be better to put them into a separate repository like Tcl/Tk and > other external binaries for Windows, and downlo

Re: [Python-Dev] Move ensurepip blobs to external place

2018-03-29 Thread Wes Turner
AFAIU, the objectives (with no particular ranking) are: - minimize git clone time and bandwidth - include latest pip with every python install - run the full test suite with CI for every PR (buildbot) - the full test suite requires pip - run the test suite locally when developing a PR - minimize

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Steven D'Aprano
On Wed, Mar 28, 2018 at 06:27:19PM +0300, Serhiy Storchaka wrote: > 2. Change the semantic of f-strings. Make it closer to the semantic of > str.format(): evaluate all subexpressions first than format them. This > can be implemented in two ways: > > 2a) Add additional instructions for stack man

[Python-Dev] [RELEASE] Python 3.7.0b3 is now available for testing

2018-03-29 Thread Ned Deily
On behalf of the Python development community and the Python 3.7 release team, I'm happy to announce the availability of Python 3.7.0b3. b3 is the third of four planned beta releases of Python 3.7, the next major release of Python, and marks the end of the feature development phase for 3.7. You c

Re: [Python-Dev] Subtle difference between f-strings and str.format()

2018-03-29 Thread Nick Coghlan
On 30 March 2018 at 03:33, Eric V. Smith wrote: > On 3/29/2018 12:13 PM, Nick Coghlan wrote: >> While more projects are starting to actively drop Python 2.x support, >> there are also quite a few still straddling the two different >> versions. The "rewrite to f-strings" approach requires explicitl

[Python-Dev] How can we use 48bit pointer safely?

2018-03-29 Thread INADA Naoki
Hi, As far as I know, most amd64 and arm64 systems use only 48bit address spaces. (except [1]) [1] https://software.intel.com/sites/default/files/managed/2b/80/5-level_paging_white_paper.pdf It means there are some chance to compact some data structures. I point two examples below. My question