Re: [Python-Dev] cpython: Issue #3329: Add new APIs to customize memory allocators

2013-06-14 Thread Nick Coghlan
On 15 June 2013 11:54, Victor Stinner wrote: > 2013/6/15 Antoine Pitrou : >>> http://hg.python.org/cpython/rev/6661a8154eb3 >>> ... >>> Issue #3329: Add new APIs to customize memory allocators >>> >>> * Add a new PyMemAllocators structure >>> * New functions: >>> >>> - PyMem_RawMalloc(), PyMem

Re: [Python-Dev] eval and triple quoted strings

2013-06-14 Thread Nick Coghlan
On 15 June 2013 14:08, Greg Ewing wrote: > Guido van Rossum wrote: >> >> Not a bug. The same is done for file input -- CRLF is changed to LF before >> tokenizing. > > > I'm not convinced it's reasonable behaviour to re-scan the > string as though it's being read from a file. It's a Python > string

Re: [Python-Dev] PEP 442 accepted

2013-06-14 Thread Nick Coghlan
On 15 June 2013 03:34, Antoine Pitrou wrote: > On Wed, 5 Jun 2013 09:10:54 -0700 > Benjamin Peterson wrote: >> I (and Guido) are accepting PEP 442 (Safe object finalization) on the >> condition that finalizers are only ever called once globally. > > Ok, so there's an issue with that condition: it

Re: [Python-Dev] eval and triple quoted strings

2013-06-14 Thread Greg Ewing
Guido van Rossum wrote: Not a bug. The same is done for file input -- CRLF is changed to LF before tokenizing. I'm not convinced it's reasonable behaviour to re-scan the string as though it's being read from a file. It's a Python string, so it's already been through whatever line-ending transfo

Re: [Python-Dev] cpython: Issue #3329: Add new APIs to customize memory allocators

2013-06-14 Thread Victor Stinner
2013/6/15 Antoine Pitrou : >> http://hg.python.org/cpython/rev/6661a8154eb3 >> ... >> Issue #3329: Add new APIs to customize memory allocators >> >> * Add a new PyMemAllocators structure >> * New functions: >> >> - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory >> a

Re: [Python-Dev] cpython: Issue #3329: Add new APIs to customize memory allocators

2013-06-14 Thread Antoine Pitrou
On Sat, 15 Jun 2013 00:44:11 +0200 (CEST) victor.stinner wrote: > http://hg.python.org/cpython/rev/6661a8154eb3 > changeset: 84127:6661a8154eb3 > user:Victor Stinner > date:Sat Jun 15 00:37:46 2013 +0200 > summary: > Issue #3329: Add new APIs to customize memory allocators >

Re: [Python-Dev] Allow calling PyMem_Malloc() without the GIL held in Python 3.4

2013-06-14 Thread Victor Stinner
I commited the new API (little bit different than my last patch on issue #3329): http://hg.python.org/cpython/rev/6661a8154eb3 The documentation will be available in a few minutes at: http://docs.python.org/3/c-api/memory.html 2013/6/14 Kristján Valur Jónsson : >> Removing the GIL restriction wou

Re: [Python-Dev] [Python-checkins] cpython: Closes issue 17947. Adds PEP-0435 (Enum, IntEnum) to the stdlib.

2013-06-14 Thread Brett Cannon
Ethan, did you forget to run ``hg add`` before committing? If not then why the heck did we argue over enums for so long if this was all it took to make everyone happy? =) On Fri, Jun 14, 2013 at 3:31 AM, ethan.furman wrote: > http://hg.python.org/cpython/rev/fae92309c3be > changeset: 84117:fae

Re: [Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

2013-06-14 Thread Robert Kern
On 2013-06-14 23:31, Robert Kern wrote: On 2013-06-14 21:55, R. David Murray wrote: On Fri, 14 Jun 2013 21:12:00 +0200, Martin Schultz wrote: 2. Testing for empty lists or empty ndarrays: In principle, `len(x) == 0` will do the trick. **BUT** there are several caveats here: - `len(scala

Re: [Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

2013-06-14 Thread Robert Kern
On 2013-06-14 21:55, R. David Murray wrote: On Fri, 14 Jun 2013 21:12:00 +0200, Martin Schultz wrote: 2. Testing for empty lists or empty ndarrays: In principle, `len(x) == 0` will do the trick. **BUT** there are several caveats here: - `len(scalar)` raises a TypeError, so you will have

Re: [Python-Dev] eval and triple quoted strings

2013-06-14 Thread PJ Eby
On Fri, Jun 14, 2013 at 2:11 PM, Ron Adam wrote: > > > On 06/14/2013 10:36 AM, Guido van Rossum wrote: >> >> Not a bug. The same is done for file input -- CRLF is changed to LF before >> tokenizing. > > > > Should this be the same? > > > python3 -c 'print(bytes("""\r\n""", "utf8"))' > b'\r\n' > >

Re: [Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

2013-06-14 Thread R. David Murray
On Fri, 14 Jun 2013 21:12:00 +0200, Martin Schultz wrote: > 2. Testing for empty lists or empty ndarrays: > > In principle, `len(x) == 0` will do the trick. **BUT** there are several > caveats here: >- `len(scalar)` raises a TypeError, so you will have to use try and > except or find some ot

Re: [Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

2013-06-14 Thread Robert Kern
On 2013-06-14 21:03, Brett Cannon wrote: On Fri, Jun 14, 2013 at 3:12 PM, Martin Schultz mailto:masch...@gmail.com>> wrote: - add a `size` attribute to all objects (I wouldn't mind if this is None in case you don't really know how to define the size of something, but it would be

Re: [Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

2013-06-14 Thread Brett Cannon
On Fri, Jun 14, 2013 at 3:12 PM, Martin Schultz wrote: > As much as I love python, the following drives me crazy, and I would wish > that some future version would come up with a more consistent approach for > this. And please don't reply with "Too bad if you don't know what type your > data are.

[Python-Dev] Clean way in python to test for None, empty, scalar, and list/ndarray? A prayer to the gods of Python

2013-06-14 Thread Martin Schultz
As much as I love python, the following drives me crazy, and I would wish that some future version would come up with a more consistent approach for this. And please don't reply with "Too bad if you don't know what type your data are..." - if I want to implement some generic functionality, I want t

Re: [Python-Dev] eval and triple quoted strings

2013-06-14 Thread Ron Adam
On 06/14/2013 10:36 AM, Guido van Rossum wrote: Not a bug. The same is done for file input -- CRLF is changed to LF before tokenizing. Should this be the same? python3 -c 'print(bytes("""\r\n""", "utf8"))' b'\r\n' >>> eval('print(bytes("""\r\n""", "utf8"))') b'\n' Ron On Jun 14, 2

Re: [Python-Dev] PEP 442 accepted

2013-06-14 Thread Antoine Pitrou
On Fri, 14 Jun 2013 19:34:41 +0200 Antoine Pitrou wrote: > On Wed, 5 Jun 2013 09:10:54 -0700 > Benjamin Peterson wrote: > > I (and Guido) are accepting PEP 442 (Safe object finalization) on the > > condition that finalizers are only ever called once globally. > > Ok, so there's an issue with tha

Re: [Python-Dev] PEP 442 accepted

2013-06-14 Thread Antoine Pitrou
On Wed, 5 Jun 2013 09:10:54 -0700 Benjamin Peterson wrote: > I (and Guido) are accepting PEP 442 (Safe object finalization) on the > condition that finalizers are only ever called once globally. Ok, so there's an issue with that condition: it can't be upholded on non-GC objects. Creating a non-GC

Re: [Python-Dev] python symbolizition

2013-06-14 Thread Isaac Morland
On Fri, 14 Jun 2013, R. David Murray wrote: This discussion is better suited for python-ideas than it is for python-dev. Better yet, perl-ideas. On Fri, 14 Jun 2013 16:50:53 +0200, Markus Unterwaditzer wrote: But why? -- Markus (from phone) Pynix Wang wrote: 1.lambda expression c# a.

[Python-Dev] Summary of Python tracker Issues

2013-06-14 Thread Python tracker
ACTIVITY SUMMARY (2013-06-07 - 2013-06-14) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open4042 (+18) closed 25946 (+41) total 29988 (+59) Open issues wit

Re: [Python-Dev] eval and triple quoted strings

2013-06-14 Thread Guido van Rossum
Not a bug. The same is done for file input -- CRLF is changed to LF before tokenizing. On Jun 14, 2013 8:27 AM, "Walter Dörwald" wrote: > Hello all! > > This surprised me: > >>>> eval("'''\r\n'''") >'\n' > > Where did the \r go? ast.literal_eval() has the same problem: > >>>> ast.lite

[Python-Dev] eval and triple quoted strings

2013-06-14 Thread Walter Dörwald
Hello all! This surprised me: >>> eval("'''\r\n'''") '\n' Where did the \r go? ast.literal_eval() has the same problem: >>> ast.literal_eval("'''\r\n'''") '\n' Is this a bug/worth fixing? Servus, Walter ___ Python-Dev mailing list Py

Re: [Python-Dev] python symbolizition

2013-06-14 Thread R. David Murray
This discussion is better suited for python-ideas than it is for python-dev. On Fri, 14 Jun 2013 16:50:53 +0200, Markus Unterwaditzer wrote: > But why? > > -- Markus (from phone) > > Pynix Wang wrote: > >1.lambda expression > > > >c# > >a.(x, y) => x == y > >b.() => SomeMethod() > > > >ruby:

Re: [Python-Dev] python symbolizition

2013-06-14 Thread Markus Unterwaditzer
But why? -- Markus (from phone) Pynix Wang wrote: >1.lambda expression > >c# >a.(x, y) => x == y >b.() => SomeMethod() > >ruby: > -> {|msg| puts msg} > >python can use c# like and remove "lambda" keyword. > >2.global variable > >ruby >$glo_var > >python can use $ or @ or another and remove "glob

[Python-Dev] python symbolizition

2013-06-14 Thread Pynix Wang
1.lambda expression c# a.(x, y) => x == y b.() => SomeMethod() ruby: -> {|msg| puts msg} python can use c# like and remove "lambda" keyword. 2.global variable ruby $glo_var python can use $ or @ or another and remove "global". ___ Python-Dev mailin

Re: [Python-Dev] cpython: Move test_pep352 over to unittest.main()

2013-06-14 Thread Serhiy Storchaka
14.06.13 04:18, brett.cannon написав(ла): http://hg.python.org/cpython/rev/af27c661d4fb changeset: 84115:af27c661d4fb user:Brett Cannon date:Thu Jun 13 21:18:43 2013 -0400 summary: Move test_pep352 over to unittest.main() You forgot about: from test.support import run_uni

Re: [Python-Dev] cpython (2.7): Fix comment blocks. Adjust blocksize to a power-of-two for better divmod

2013-06-14 Thread Serhiy Storchaka
14.06.13 11:46, Antoine Pitrou написав(ла): On Fri, 14 Jun 2013 07:06:49 +0200 (CEST) raymond.hettinger wrote: http://hg.python.org/cpython/rev/5accb0ac8bfb changeset: 84116:5accb0ac8bfb Fix comment blocks. Adjust blocksize to a power-of-two for better divmod computations. Is there any

Re: [Python-Dev] Allow calling PyMem_Malloc() without the GIL held in Python 3.4

2013-06-14 Thread Kristján Valur Jónsson
> -Original Message- > I would like to remove the "GIL must be held" restriction from > PyMem_Malloc(). In my opinion, the restriction was motived by a bug in > Python, bug fixed by the issue #3329. Let me explain why. > ... > > Removing the GIL restriction would help to replace direct

Re: [Python-Dev] cpython (2.7): Fix comment blocks. Adjust blocksize to a power-of-two for better divmod

2013-06-14 Thread Antoine Pitrou
On Fri, 14 Jun 2013 07:06:49 +0200 (CEST) raymond.hettinger wrote: > http://hg.python.org/cpython/rev/5accb0ac8bfb > changeset: 84116:5accb0ac8bfb > branch: 2.7 > parent: 84095:ca8e86711403 > user:Raymond Hettinger > date:Fri Jun 14 01:06:33 2013 -0400 > summary: > F