Re: [Python-Dev] Accepting PEP 3154 for 3.4?

2013-11-17 Thread Tim Peters
[Antoine Pitrou] > Alexandre Vassalotti (thanks a lot!) has recently finalized his work on > the PEP 3154 implementation - pickle protocol 4. > > I think it would be good to get the PEP and the implementation accepted > for 3.4. As far as I can say, this has been a low-controvery proposal, > and it

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Barry Warsaw
On Nov 17, 2013, at 11:05 PM, Maciej Fijalkowski wrote: >My problem with -O and -OO is that their arguments are very circular. >Indeed, I understand the need why you would want in certain and >limited cases to remove both docstrings and asserts. So some options >for doing so are ok. But a lot of a

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Jan Kaliszewski
17.11.2013 23:05, Guido van Rossum wrote: The correct rule should be "don't use assert (the statement) to check for valid user input" and the stated reason should be that the assert statement was *designed* to be disabled globally, not to be a shorthand for "if not X: raise (mumble) Y". A coroll

Re: [Python-Dev] NTPath or WindowsPath?

2013-11-17 Thread Brian Curtin
On Sat, Nov 16, 2013 at 2:50 PM, Serhiy Storchaka wrote: > 16.11.13 21:15, Antoine Pitrou написав(ла): > >> In a (private) discussion about PEP 428 and pathlib, Guido proposed >> that maybe NTPath should be renamed to WindowsPath, since the name is >> more likely to stay relevant in the middle ter

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Guido van Rossum
On Sun, Nov 17, 2013 at 1:05 PM, Maciej Fijalkowski wrote: > My problem with -O and -OO is that their arguments are very circular. > Indeed, I understand the need why you would want in certain and > limited cases to remove both docstrings and asserts. So some options > for doing so are ok. But a l

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Greg Ewing
Gregory Salvan wrote: I believe the point of removing assertions is also to avoid throwing unhandled developper errors to end-user I'm not sure I buy that. An assert is saying that something should never happen. If it does happen, either it's going to lead to an exception further down the track

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Maciej Fijalkowski
On Sun, Nov 17, 2013 at 9:02 PM, Barry Warsaw wrote: > On Nov 17, 2013, at 05:14 PM, Victor Stinner wrote: > >>2013/11/16 Maciej Fijalkowski : >>> Can I see some writeup how -OO benefit embedded devices? >> >>You get smaller .pyc files. In an embedded device, the whole OS may be >>written in a sma

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Barry Warsaw
On Nov 17, 2013, at 05:14 PM, Victor Stinner wrote: >2013/11/16 Maciej Fijalkowski : >> Can I see some writeup how -OO benefit embedded devices? > >You get smaller .pyc files. In an embedded device, the whole OS may be >written in a small memory, something like 64 MB or smaller. Removing >doctring

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread R. David Murray
On Sun, 17 Nov 2013 17:14:38 +0100, Victor Stinner wrote: > 2013/11/16 Maciej Fijalkowski : > > Can I see some writeup how -OO benefit embedded devices? > > You get smaller .pyc files. In an embedded device, the whole OS may be > written in a small memory, something like 64 MB or smaller. Removi

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Gregory Salvan
I believe the point of removing assertions is also to avoid throwing unhandled developper errors to end-user and not only "performance". It's like "raise" without "try" block. It's certainly because I consider "assert" as a developper util, providing a concrete documentation about methods signatur

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Guido van Rossum
On Saturday, November 16, 2013, Steven D'Aprano wrote: > On Sat, Nov 16, 2013 at 11:16:48AM -0500, Donald Stufft wrote: > > Personally I think that none of the -O* should be removing asserts. It > feels > > like a foot gun to me. I’ve seen more than one codebase that would be > > completely broken

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Victor Stinner
2013/11/16 Maciej Fijalkowski : > Can I see some writeup how -OO benefit embedded devices? You get smaller .pyc files. In an embedded device, the whole OS may be written in a small memory, something like 64 MB or smaller. Removing doctrings help to fit in 64 MB. I don't know if dropping "assert"

Re: [Python-Dev] Mixed up core/module source file locations in CPython

2013-11-17 Thread Eli Bendersky
On Sun, Nov 17, 2013 at 6:20 AM, Brett Cannon wrote: > > On Nov 17, 2013 8:58 AM, "Eli Bendersky" wrote: > > > > > > > > > > On Sat, Nov 16, 2013 at 3:44 PM, Brett Cannon wrote: > >> > >> > >> > >> > >> On Sat, Nov 16, 2013 at 1:40 PM, Eric Snow > wrote: > >>> > >>> If you look at the Python a

Re: [Python-Dev] Mixed up core/module source file locations in CPython

2013-11-17 Thread Brett Cannon
On Nov 17, 2013 8:58 AM, "Eli Bendersky" wrote: > > > > > On Sat, Nov 16, 2013 at 3:44 PM, Brett Cannon wrote: >> >> >> >> >> On Sat, Nov 16, 2013 at 1:40 PM, Eric Snow wrote: >>> >>> If you look at the Python and Modules directories in the cpython repo, >>> you'll find modules in Python/ and co

Re: [Python-Dev] Mixed up core/module source file locations in CPython

2013-11-17 Thread Eli Bendersky
On Sat, Nov 16, 2013 at 3:44 PM, Brett Cannon wrote: > > > > On Sat, Nov 16, 2013 at 1:40 PM, Eric Snow wrote: > >> If you look at the Python and Modules directories in the cpython repo, >> you'll find modules in Python/ and core files (like python.c and >> main.c) in Modules/. (It's like parkin

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Pascal Chambon
Le 17/11/2013 12:27, Steven D'Aprano a écrit : What I would like to know is if people *knowingly* add costly asserts to performance-critical code, with the intent of disabling them at runtime using -OO. Yes, I have knowingly added costly asserts to code with the intend of disabling them at runt

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Steven D'Aprano
On Sun, Nov 17, 2013 at 11:35:21AM +0100, Antoine Pitrou wrote: > You didn't answer my question: did you actually use -OO in production, > or not? Saying that -OO could have helped you optimize something you > didn't care about isn't a very strong argument for -OO :) Ah, sorry, I misunderstood yo

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Antoine Pitrou
On Sun, 17 Nov 2013 21:27:24 +1100 Steven D'Aprano wrote: > On Sun, Nov 17, 2013 at 11:00:50AM +0100, Antoine Pitrou wrote: > > On Sun, 17 Nov 2013 18:04:43 +1100 > > Steven D'Aprano wrote: > > > On Sat, Nov 16, 2013 at 04:46:00PM +0100, Antoine Pitrou wrote: > > > > > > > I agree that conflatin

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Steven D'Aprano
On Sun, Nov 17, 2013 at 11:00:50AM +0100, Antoine Pitrou wrote: > On Sun, 17 Nov 2013 18:04:43 +1100 > Steven D'Aprano wrote: > > On Sat, Nov 16, 2013 at 04:46:00PM +0100, Antoine Pitrou wrote: > > > > > I agree that conflating the two doesn't help the discussion. > > > While removing docstrings

Re: [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

2013-11-17 Thread Antoine Pitrou
On Sun, 17 Nov 2013 18:04:43 +1100 Steven D'Aprano wrote: > On Sat, Nov 16, 2013 at 04:46:00PM +0100, Antoine Pitrou wrote: > > > I agree that conflating the two doesn't help the discussion. > > While removing docstrings may be beneficial on memory-constrained > > devices, I can't remember a sing