Re: [Python-Dev] RFC: Add a new builtin strarray type to Python?

2011-10-03 Thread Hrvoje Niksic
On 10/02/2011 06:34 PM, Alex Gaynor wrote: There are a number of issues that are being conflated by this thread. 1) Should str += str be fast. In my opinion, the answer is an obvious and resounding no. Strings are immutable, thus repeated string addition is O(n**2). This is a natural

Re: [Python-Dev] Python Core Tools

2011-10-03 Thread renaud
Maciej Fijalkowski fijall at gmail.com writes: https://bitbucket.org/pypy/pypy/src/59460302c713/lib_pypy/disassembler.py this might be of interest. It's like dis module except it creates objects instead of printing them I think that Issue11816 (under review) aims at extending the dis

[Python-Dev] counterintuitive behavior (bug?) in Counter with +=

2011-10-03 Thread Lars Buitinck
Hello, [First off, I'm not a member of this list, so please Cc: me in a reply!] I've found some counterintuitive behavior in collections.Counter while hacking on the scikit-learn project [1]. I wanted to use a bunch of Counters to do some simple term counting in a set of documents, roughly as

Re: [Python-Dev] counterintuitive behavior (bug?) in Counter with +=

2011-10-03 Thread INADA Naoki
+1 Because Counter is mutable object, I think += should mutate left side object. On Mon, Oct 3, 2011 at 7:12 PM, Lars Buitinck l.j.buiti...@uva.nl wrote: Hello, [First off, I'm not a member of this list, so please Cc: me in a reply!] I've found some counterintuitive behavior in

Re: [Python-Dev] RFC: Add a new builtin strarray type to Python?

2011-10-03 Thread Victor Stinner
Le 03/10/2011 04:19, Victor Stinner a écrit : I restored this hack in Python 3.3 using PyUnicode_Append() in ceval.c and by optimizing PyUnicode_Append() (try to append in-place). str+=str is closer again to ''.join: str += str: 696 ms ''.join(): 547 ms I disabled temporary the optimization

Re: [Python-Dev] RFC: Add a new builtin strarray type to Python?

2011-10-03 Thread Martin v. Löwis
I restored this hack in Python 3.3 using PyUnicode_Append() in ceval.c and by optimizing PyUnicode_Append() (try to append in-place). str+=str is closer again to ''.join: Why are you checking, in unicode_resizable, whether the string is from unicode_latin1? If it is, then it should have a

Re: [Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal()

2011-10-03 Thread Martin v. Löwis
What I'm looking for is a public function that is silently updated if python-dev decides to accept other numerical input. As I understand from your comments below, PyUnicode_EncodeDecimal() is frozen, so that function does indeed not help. I would consider it reasonable for

Re: [Python-Dev] cpython: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown

2011-10-03 Thread Martin v. Löwis
Am 02.10.2011 17:46, schrieb Benjamin Peterson: 2011/10/2 Georg Brandl g.bra...@gmx.net: On 10/02/11 01:14, victor.stinner wrote: http://hg.python.org/cpython/rev/9124a00df142 changeset: 72573:9124a00df142 parent: 72571:fa0b1e50270f user:Victor Stinner

[Python-Dev] PEP 3151 state

2011-10-03 Thread Antoine Pitrou
Hello, I am back from holiday ;) and we haven't heard from other implementations whether there was any difficulty for them in implementing PEP 3151. Did I miss something (it's difficult to keep up with many messages on a small netbook with a screen broken by a batman-like pattern obscuring the

Re: [Python-Dev] RFC: Add a new builtin strarray type to Python?

2011-10-03 Thread Victor Stinner
Le lundi 3 octobre 2011 18:04:57, vous avez écrit : Why are you checking, in unicode_resizable, whether the string is from unicode_latin1? If it is, then it should have a refcount of at least 2, so the very first test in the function should already exclude it. There is also a test on

Re: [Python-Dev] cpython: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown

2011-10-03 Thread Stephen J. Turnbull
Martin v. Löwis writes: Also, could I remind you that a better commit message is probably make PyUnicode_FromKindAndData raise a ValueError if the kind is unknown. I think this is asking too much. This distinction is important enough that it's worth asking non-native speakers to

Re: [Python-Dev] PEP 3151 state

2011-10-03 Thread Antoine Pitrou
On Mon, 3 Oct 2011 19:56:04 +0200 Antoine Pitrou solip...@pitrou.net wrote: Hello, I am back from holiday ;) and we haven't heard from other implementations whether there was any difficulty for them in implementing PEP 3151. Alex Gaynor and Jim Baker (thank you!) just told me on IRC that

Re: [Python-Dev] PEP 3151 state

2011-10-03 Thread Jeff Hardy
On Mon, Oct 3, 2011 at 11:32 AM, Antoine Pitrou solip...@pitrou.net wrote: On Mon, 3 Oct 2011 19:56:04 +0200 Antoine Pitrou solip...@pitrou.net wrote: Hello, I am back from holiday ;) and we haven't heard from other implementations whether there was any difficulty for them in

Re: [Python-Dev] cpython: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown

2011-10-03 Thread Terry Reedy
On 10/3/2011 12:23 PM, Martin v. Löwis wrote: Am 02.10.2011 17:46, schrieb Benjamin Peterson: On 10/02/11 01:14, victor.stinner wrote: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown Also, could I remind you that a better commit message is probably make

Re: [Python-Dev] cpython: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown

2011-10-03 Thread Martin v. Löwis
Is it both technically possible (with hg) and socially permissible (with us) to edit another's commit message? It's not technically possible, but it would be socially permissible to fix spelling mistakes. With hg, editing commit messages would require some sort of patch queue system, where the

Re: [Python-Dev] cpython: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown

2011-10-03 Thread Victor Stinner
-assert(0); +PyErr_SetString(PyExc_ValueError, invalid kind); return NULL; } Is that really a ValueError? It should only be a ValueError if the user could trigger that error. Otherwise it should be a SystemError. You are right, ValueError is not best exception

[Python-Dev] Python compatibility issue with Windows Developer Preview

2011-10-03 Thread Ryan Wells (MP Tech Consulting LLC)
Hello Python Developers, I am a Program Manager with the Ecosystem Engineering team at Microsoft. We are tracking a issue with Python 3.2.2 on Windows Developer Preview when using Internet Explorer. At //BUILD/http://www.buildwindows.com/ in September, Microsoft announced the availability of

Re: [Python-Dev] Python compatibility issue with Windows Developer Preview

2011-10-03 Thread Brian Curtin
On Mon, Oct 3, 2011 at 18:32, Ryan Wells (MP Tech Consulting LLC) v-ry...@microsoft.com wrote: Hello Python Developers, ** ** I am a Program Manager with the Ecosystem Engineering team at Microsoft. We are tracking a issue with Python 3.2.2 on Windows Developer Preview when using

Re: [Python-Dev] cpython: PyUnicode_FromKindAndData() raises a ValueError if the kind is unknown

2011-10-03 Thread Stephen J. Turnbull
Martin v. Löwis writes: [Terry Reedy wrote:] Is it both technically possible (with hg) and socially permissible (with us) to edit another's commit message? It's not technically possible, Currently, in hg. git has a mechanism for adding notes which are automatically displayed along