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

2013-06-15 Thread Gregory P. Smith
fwiw i'm also supportive of adding these apis. Lets PEP away to iron out any details or document disagreements but overall I'd also like to see something a lot like these go in. -gps On Fri, Jun 14, 2013 at 10:50 PM, Nick Coghlan ncogh...@gmail.com wrote: On 15 June 2013 11:54, Victor

Re: [Python-Dev] PEP 442 accepted

2013-06-15 Thread Antoine Pitrou
On Sat, 15 Jun 2013 14:57:49 +1000 Nick Coghlan ncogh...@gmail.com wrote: On 15 June 2013 03:34, Antoine Pitrou solip...@pitrou.net wrote: On Wed, 5 Jun 2013 09:10:54 -0700 Benjamin Peterson benja...@python.org wrote: I (and Guido) are accepting PEP 442 (Safe object finalization) on the

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

2013-06-15 Thread Antoine Pitrou
On Sat, 15 Jun 2013 03:54:50 +0200 Victor Stinner victor.stin...@gmail.com wrote: The addition of PyMem_RawMalloc() is motivated by the issue #18203 (Replace calls to malloc() with PyMem_Malloc()). The goal is to be able to setup a custom allocator for *all* allocation made by Python, so

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

2013-06-15 Thread Nick Coghlan
On 15 June 2013 21:01, Antoine Pitrou solip...@pitrou.net wrote: On Sat, 15 Jun 2013 03:54:50 +0200 Victor Stinner victor.stin...@gmail.com wrote: The addition of PyMem_RawMalloc() is motivated by the issue #18203 (Replace calls to malloc() with PyMem_Malloc()). The goal is to be able to

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

2013-06-15 Thread Antoine Pitrou
On Sat, 15 Jun 2013 22:22:33 +1000 Nick Coghlan ncogh...@gmail.com wrote: On 15 June 2013 21:01, Antoine Pitrou solip...@pitrou.net wrote: On Sat, 15 Jun 2013 03:54:50 +0200 Victor Stinner victor.stin...@gmail.com wrote: The addition of PyMem_RawMalloc() is motivated by the issue #18203

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-15 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/14/2013 04:55 PM, R. David Murray wrote: This I sort of agree with. I've often enough wanted to know if something is a non-string iterable. But you'd have to decide if bytes/bytearray is a sequence of integers or a scaler... In fifteen

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

2013-06-15 Thread Victor Stinner
Le 15 juin 2013 03:54, Victor Stinner victor.stin...@gmail.comjavascript:_e({}, 'cvml', 'victor.stin...@gmail.com'); a écrit : Ok, I reverted my commit. I will work on a PEP to explain all these new functions and their use cases. I created the PEP 445 to reserve the number. It is ready for a

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-15 Thread Donald Stufft
I never want to iterate, but I love slice syntax and indexing. Don't think you can have that w/o being able to loop over it can you? Maybe I'm just thinking slow since I just woke up. On Jun 15, 2013, at 8:53 AM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE-

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-15 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/15/2013 09:15 AM, Donald Stufft wrote: I never want to iterate, but I love slice syntax and indexing. Don't think you can have that w/o being able to loop over it can you? Maybe I'm just thinking slow since I just woke up. You could if

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

2013-06-15 Thread Nick Coghlan
On 15 June 2013 22:41, Antoine Pitrou solip...@pitrou.net wrote: On Sat, 15 Jun 2013 22:22:33 +1000 Nick Coghlan ncogh...@gmail.com wrote: For custom allocators, it's useful to be able to *ensure* you can bypass CPython's small object allocator, rather than having to rely on it being

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

2013-06-15 Thread Antoine Pitrou
On Sun, 16 Jun 2013 00:12:02 +1000 Nick Coghlan ncogh...@gmail.com wrote: On 15 June 2013 22:41, Antoine Pitrou solip...@pitrou.net wrote: On Sat, 15 Jun 2013 22:22:33 +1000 Nick Coghlan ncogh...@gmail.com wrote: For custom allocators, it's useful to be able to *ensure* you can bypass

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-15 Thread Oscar Benjamin
Your questions/suggestions are off-topic for this list. This belongs on python-ideas. On 14 June 2013 20:12, Martin Schultz masch...@gmail.com wrote: 2. Testing for empty lists or empty ndarrays: 4. Finding the number of elements in an object: 6. Detecting None values in a list: Each of the

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

2013-06-15 Thread Christian Heimes
Am 15.06.2013 14:22, schrieb Nick Coghlan: However, it's still desirable to be able to monitor those direct allocations in debug mode, thus it makes sense to have a GIL protected direct allocation API as well. You could try to hide the existence of the latter behaviour and treat it as a

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

2013-06-15 Thread Christian Heimes
Am 15.06.2013 14:57, schrieb Victor Stinner: Le 15 juin 2013 03:54, Victor Stinner victor.stin...@gmail.com javascript:_e({}, 'cvml', 'victor.stin...@gmail.com'); a écrit : Ok, I reverted my commit. I will work on a PEP to explain all these new functions and their use cases. I created

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

2013-06-15 Thread Ron Adam
On 06/14/2013 04:03 PM, PJ Eby wrote: Should this be the same? python3 -c 'print(bytes(\r\n, utf8))' b'\r\n' eval('print(bytes(\r\n, utf8))') b'\n' No, but: eval(r'print(bytes(\r\n, utf8))') should be. (And is.) What I believe you and Walter are missing is that the \r\n in the eval

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-15 Thread Terry Reedy
On 6/15/2013 8:53 AM, Tres Seaver wrote: In fifteen years of Python programming, I have literally *never* wanted to iterate over 'str' (or now 'bytes'). If so, it is because you have always been able to use pre-written methods and functions that internally do the iteration for you. I've

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

2013-06-15 Thread Guido van Rossum
The semantics of raw strings are clear. I don't see that they should be called out especially in any context. (Except for regexps.) Usually exec() is not used with a literal anyway (what would be the point). --Guido van Rossum (sent from Android phone) On Jun 15, 2013 1:03 PM, Ron Adam

[Python-Dev] backported Enum

2013-06-15 Thread Ethan Furman
So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name is already taken. Would it be inappropriate to call it `stdlib.enum`? -- ~Ethan~ ___ Python-Dev

Re: [Python-Dev] backported Enum

2013-06-15 Thread Antoine Pitrou
On Sat, 15 Jun 2013 12:46:32 -0700 Ethan Furman et...@stoneleaf.us wrote: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name is already taken. Would it be inappropriate to call it

Re: [Python-Dev] backported Enum

2013-06-15 Thread Barry Warsaw
On Jun 15, 2013, at 12:46 PM, Ethan Furman wrote: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name is already taken. Would it be inappropriate to call it `stdlib.enum`? The last upload was on

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-15 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/15/2013 04:11 PM, Terry Reedy wrote: On 6/15/2013 8:53 AM, Tres Seaver wrote: In fifteen years of Python programming, I have literally *never* wanted to iterate over 'str' (or now 'bytes'). If so, it is because you have always been able

Re: [Python-Dev] backported Enum

2013-06-15 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/15/2013 05:14 PM, Barry Warsaw wrote: On Jun 15, 2013, at 12:46 PM, Ethan Furman wrote: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name

Re: [Python-Dev] backported Enum

2013-06-15 Thread Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]
What if there's some obscure PyPi module that requires that `enum` package, or some other project (not hosted on PyPI) that requires Ben Finney's original `enum` package? Is there anyway to get usage data to make sure nobody's been using it recently? ML On Jun 15, 2013, at 5:14 PM, Barry

Re: [Python-Dev] backported Enum

2013-06-15 Thread Ethan Furman
On 06/15/2013 01:53 PM, Antoine Pitrou wrote: On Sat, 15 Jun 2013 12:46:32 -0700 Ethan Furman et...@stoneleaf.us wrote: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name is already taken.

Re: [Python-Dev] backported Enum

2013-06-15 Thread Gregory P. Smith
I tend to just pick a name and stick with it. subprocess32 is subprocess backported from 3.2 (with the 3.3 timeout feature also in it). unittest2 is unittest from 2.7. It tends to work. and it also emphasizes that i'm unlikely to backport future non-bugfix updates beyond the release mentioned

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

2013-06-15 Thread Victor Stinner
2013/6/15 Christian Heimes christ...@python.org: Am 15.06.2013 14:22, schrieb Nick Coghlan: However, it's still desirable to be able to monitor those direct allocations in debug mode, thus it makes sense to have a GIL protected direct allocation API as well. You could try to hide the existence

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

2013-06-15 Thread Victor Stinner
2013/6/15 Antoine Pitrou solip...@pitrou.net: On Sat, 15 Jun 2013 03:54:50 +0200 Victor Stinner victor.stin...@gmail.com wrote: The addition of PyMem_RawMalloc() is motivated by the issue #18203 (Replace calls to malloc() with PyMem_Malloc()). The goal is to be able to setup a custom

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

2013-06-15 Thread Victor Stinner
2013/6/15 Nick Coghlan ncogh...@gmail.com: The only reason for the small object allocator to exist is because operating system allocators generally aren't optimised for frequent allocation and deallocation of small objects. You can gain a *lot* of speed from handling those inside the

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

2013-06-15 Thread Victor Stinner
2013/6/15 Antoine Pitrou solip...@pitrou.net: Moreover, I think you are conflating two issues: the ability to add memory allocation hooks (for tracing/debugging purposes), and the adaptation to non-traditional memory models (whatever that means). Those concerns don't necessarily come together.

Re: [Python-Dev] backported Enum

2013-06-15 Thread Donald Stufft
On Jun 15, 2013, at 5:43 PM, Ethan Furman et...@stoneleaf.us wrote: On 06/15/2013 01:53 PM, Antoine Pitrou wrote: On Sat, 15 Jun 2013 12:46:32 -0700 Ethan Furman et...@stoneleaf.us wrote: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I

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

2013-06-15 Thread Ron Adam
On 06/15/2013 03:23 PM, Guido van Rossum wrote: The semantics of raw strings are clear. I don't see that they should be called out especially in any context. (Except for regexps.) Usually exec() is not used with a literal anyway (what would be the point). There are about a hundred instances

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

2013-06-15 Thread Nick Coghlan
On 16 Jun 2013 10:54, Victor Stinner victor.stin...@gmail.com wrote: 2013/6/15 Antoine Pitrou solip...@pitrou.net: Moreover, I think you are conflating two issues: the ability to add memory allocation hooks (for tracing/debugging purposes), and the adaptation to non-traditional memory

Re: [Python-Dev] backported Enum

2013-06-15 Thread Ben Finney
Ethan Furman et...@stoneleaf.us writes: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name is already taken. I have for a long time approved of ‘flufl.enum’ becoming the One Obvious Way to do

Re: [Python-Dev] backported Enum

2013-06-15 Thread Donald Stufft
On Jun 15, 2013, at 10:45 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Ethan Furman et...@stoneleaf.us writes: So I have the stdlb 3.4 Enum backported for both earlier 3.x and back to 2.4 in the 2.x series. I would like to put this on PyPI, but the `enum` name is already taken.

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-15 Thread Terry Reedy
On 6/15/2013 5:45 PM, Tres Seaver wrote: Given that strings are implemented in C, That is a current implementation detail. String functions were originally written in python in string.py. Some used 'for c in s:'. The functions only because methods after 2.2. I presume Pypy starts from

Re: [Python-Dev] backported Enum

2013-06-15 Thread Ben Finney
Donald Stufft don...@stufft.io writes: On Jun 15, 2013, at 10:45 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Is there anything I can do to keep the ‘enum’ package online for continuity but make it clear, to automated tools, that this is end-of-life and obsoleted by another package?