[Python-Dev] Arena-freeing obmalloc ready for testing

2006-03-01 Thread Tim Peters
I spent most of my PyCon sprint time so far working on Evan Jones's arena-freeing obmalloc patch: http://www.python.org/sf/1123430 It's ready to test now! The work is on a branch: svn+ssh://svn.python.org/python/branches/tim-obmalloc Only obmalloc.c is changed in that branch, and you c

Re: [Python-Dev] Making staticmethod objects callable?

2006-03-01 Thread Nicolas Fleury
Guido van Rossum wrote: > In which context did you find a need for defining a static method and > calling it inside the class definition? I'm guessing that what you're > playing dubious scoping games. I'm not. I almost never use staticmethod actually. I find them not very pythonic, in my humble

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Josiah Carlson
Greg Ewing <[EMAIL PROTECTED]> wrote: >u = unicode(b) >u = unicode(b, 'utf8') >b = bytes['utf8'](u) >u = unicode['base64'](b) # encoding >b = bytes(u, 'base64') # decoding >u2 = unicode['piglatin'](u1) # encoding >u1 = unicode(u2, 'piglatin') # decoding Your

Re: [Python-Dev] When will regex really go away?

2006-03-01 Thread Neal Norwitz
On 1/24/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 1/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > I ran Fredrik's listmodules script in my current sandbox and got a > > deprecation warning for the regex module. According to PEP 4 it is already > > obsolete. I saw nothing

[Python-Dev] Weekly Python Patch/Bug Summary

2006-03-01 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 382 open ( -3) / 3079 closed (+12) / 3461 total ( +9) Bugs: 880 open (+16) / 5624 closed ( +3) / 6504 total (+19) RFE : 211 open ( +0) / 201 closed ( +1) / 412 total ( +1) New / Reopened Patches __ PEP 357 -

[Python-Dev] DRAFT: python-dev Summary for 2006-01-16 through 2005-01-31

2006-03-01 Thread Tony Meyer
Here's the draft for the second half of January. First half of February on its way soon. Any suggestions/corrections/additions/comments welcome. Thanks! -TAM = Announcements = - Google summer internships - Google is look

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
Ron Adam wrote: > 1. We can specify the operation and not be sure of the resulting type. > >*or* > > 2. We can specify the type and not always be sure of the operation. > > maybe there's a way to specify both so it's unambiguous? Here's another take on the matter. When we're doing Unicode

Re: [Python-Dev] test_compiler failure

2006-03-01 Thread Guido van Rossum
Thanks! This was due to a bug in the code for creating the AST for an expr-less yield. Fixed in r42772. On 3/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I just found that test_compiler fails on test_contextlib.py. > To reproduce the failure, run > > from compiler import compileFile > comp

Re: [Python-Dev] defaultdict and on_missing()

2006-03-01 Thread Greg Ewing
Guido van Rossum wrote: > str.join() is an interesting case... > Making it a > string method is arguably the right thing to do, since this operation > only makes sense for strings. > The type of such a polymorphic function is easily specified: > join(sequence[T], T) -> T, where T is a string-

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Ron Adam
Greg Ewing wrote: > Ron Adam wrote: > >> While playing around with the example bytes class I noticed code reads >> much better when I use methods called tounicode and tostring. >> >> b64ustring = b.tounicode('base64') >> b = bytes(b64ustring, 'base64') > > I don't like that, because it c

Re: [Python-Dev] defaultdict and on_missing()

2006-03-01 Thread Guido van Rossum
On 3/1/06, Brett Cannon <[EMAIL PROTECTED]> wrote: > But moving over to more attributes for how we access basic interfaces > seems great to me. We shouldn't approach this as "methods good, functions bad" -- nor the opposite, for that matter. When all things are equal, I'd much rather do usability

Re: [Python-Dev] bytes thoughts

2006-03-01 Thread Greg Ewing
Baptiste Carvello wrote: > while manipulating binary data will happen mostly with bytes objects, some > operations are better done with ints, like the bit manipulations with the > &|~^ > operators. Why not just support bitwise operations directly on the bytes object? -- Greg Ewing, Computer

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-01 Thread martin
Zitat von Michael Urman <[EMAIL PROTECTED]>: > On 3/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How would this be accomplished - by a function with a ton of optional > templated arguments? That's how I would do it. Actually, I would have PyArg_ParseTuple overloaded with different numbers

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Michael Urman
[My apologies Greg; I meant to send this to the whole list. I really need a list-reply button in GMail. ] On 3/1/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > I don't like that, because it creates a dependency > (conceptually, at least) between the bytes type and > the unicode type. I only find hal

Re: [Python-Dev] iterator API in Py3.

2006-03-01 Thread Greg Ewing
Raymond Hettinger wrote: > [Greg Ewing] > > > And you don't think there are many different > > types of iterables? > > Um, I meant iterators and suspect you meant the same -- The same comment applies either way. Each type of iterable usually has its own corresponding type of iterator. > YAGNI.

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
Ron Adam wrote: > While playing around with the example bytes class I noticed code reads > much better when I use methods called tounicode and tostring. > > b64ustring = b.tounicode('base64') > b = bytes(b64ustring, 'base64') I don't like that, because it creates a dependency (conceptua

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
Bill Janssen wrote: > No, once it's in a particular encoding it's bytes, no longer text. The point at issue is whether the characters produced by base64 are in a particular encoding. According to my reading of the RFC, they're not. -- Greg Ewing, Computer Science Dept, +

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-01 Thread Michael Urman
On 3/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > There are a few advantages, though, mainly: > - increased type-safety, in particular for API that isn't type-checked > at all at the moment (e.g. PyArg_ParseTuple) How would this be accomplished - by a function with a ton of optional temp

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Greg Ewing
Nick Coghlan wrote: >ascii_bytes = orig_bytes.decode("base64").encode("ascii") > >orig_bytes = ascii_bytes.decode("ascii").encode("base64") > > The only slightly odd aspect is that this inverts the conventional meaning of > base64 encoding and decoding, -1. Whatever we do, we shouldn't

Re: [Python-Dev] Making staticmethod objects callable?

2006-03-01 Thread Guido van Rossum
On 3/1/06, Nicolas Fleury <[EMAIL PROTECTED]> wrote: > The problem is that even after explaining descriptors (which IMHO can be > a more advanced feature for newbies), you still need a workaround and > you might end up with (or call __get__): > > class A: > def foo(): pass > bar = foo() >

Re: [Python-Dev] bytes thoughts

2006-03-01 Thread Baptiste Carvello
some more thoughts about the bytes object: 1) it would be nice to have an trivial way to change a bytes object to an int / long, and vice versa. Rationale: while manipulating binary data will happen mostly with bytes objects, some operations are better done with ints, like the bit manipulation

[Python-Dev] test_compiler failure

2006-03-01 Thread martin
I just found that test_compiler fails on test_contextlib.py. To reproduce the failure, run from compiler import compileFile compileFile("Lib/test/test_contextlib.py") Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyth

Re: [Python-Dev] Webstats for www.python.org et al.

2006-03-01 Thread Thomas Wouters
On 3/1/06, Jack Diederich <[EMAIL PROTECTED]> wrote: > On Wed, Mar 01, 2006 Brett Cannon wrote: > > On 2/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > Thomas Wouters wrote: > > > > > > > I added webstats for all subsites of python.org: > > > > > > > > http://www.python.org/webstats/ > > > >

Re: [Python-Dev] Slightly OT: Replying to posts

2006-03-01 Thread Aahz
On Wed, Mar 01, 2006, Talin wrote: > > However, I would like to be able to reply to posts in such a way as to > have them appear in the appropriate place in the thread hierarchy. Since > I don't have the original email, I cannot reply to it directly; instead > I have to create a new, non-reply e

[Python-Dev] wiki as scratchpad

2006-03-01 Thread Aahz
On Wed, Mar 01, 2006, Jason Orendorff wrote: > > 3. I wrote a toy BytesIO class to go with the toy bytes object: > http://wiki.python.org/moin/BytesIO > (I hope this isn't considered wiki abuse -- it seemed as worthy and > relevant as most of what's in there.) Au contraire! This is precisely wh

[Python-Dev] bytes thoughts

2006-03-01 Thread Jason Orendorff
1. Maybe there should be a more obvious way to spell "bytes([0])*N". I went through "bytes([0]*N)" and "bytes('\0'*N)" before I realized there was a memory-efficient way to do it. 1a. Likewise, slice-assignment nicely handles memmove(), but there's no memset(). 2. Having a plural noun as a typ

Re: [Python-Dev] Webstats for www.python.org et al.

2006-03-01 Thread Jack Diederich
On Wed, Mar 01, 2006 Brett Cannon wrote: > On 2/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Thomas Wouters wrote: > > > > > I added webstats for all subsites of python.org: > > > > > > http://www.python.org/webstats/ > > > > what's that "Java/1.4.2_03" user agent doing? (it's responsible f

Re: [Python-Dev] Making staticmethod objects callable?

2006-03-01 Thread Nicolas Fleury
Steven Bethard wrote: > My only (mild) concern is that if staticmethod is going to get a > __call__, I think classmethod should probably get one too. Inside a > class this doesn't make much sense: I agree, make sense or not, if "@staticmethod def foo()" and a simple "def foo(self)" can all be ca

Re: [Python-Dev] Slightly OT: Replying to posts

2006-03-01 Thread Terry Reedy
"Talin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Just a quick question about the mechanics of replying to this list. > > I am a subscriber to the list, however I much prefer readiing the list > archives on the web instead of having the postings delivered to my email > account.

Re: [Python-Dev] Slightly OT: Replying to posts

2006-03-01 Thread Barry Warsaw
On Wed, 2006-03-01 at 11:00 -0800, Talin wrote: > However, I would like to be able to reply to posts in such a way as to > have them appear in the appropriate place in the thread hierarchy. Since > I don't have the original email, I cannot reply to it directly; instead > I have to create a new,

Re: [Python-Dev] Webstats for www.python.org et al.

2006-03-01 Thread Brett Cannon
On 2/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Thomas Wouters wrote: > > > I added webstats for all subsites of python.org: > > > > http://www.python.org/webstats/ > > what's that "Java/1.4.2_03" user agent doing? (it's responsible for > 10% of all hits in january/february, and 20% of the

Re: [Python-Dev] defaultdict and on_missing()

2006-03-01 Thread Brett Cannon
On 2/28/06, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Greg Ewing" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > And you don't think there are many different > > types of iterables? You might as well argue > > that we don't need len() because it "only > > applies to sequences".

[Python-Dev] Slightly OT: Replying to posts

2006-03-01 Thread Talin
Just a quick question about the mechanics of replying to this list. I am a subscriber to the list, however I much prefer readiing the list archives on the web instead of having the postings delivered to my email account. Because of this, I have delivery turned off in the mailing list preference

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Michael Chermside
I wrote: > ... I will say that if there were no legacy I'd prefer the tounicode() > and tostring() (but shouldn't itbe 'tobytes()' instead?) names for Python 3.0. Scott Daniels replied: > Wouldn't 'tobytes' and 'totext' be better for 3.0 where text == unicode? Um... yes. Sorry, I'm not completely

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Scott David Daniels
Chermside, Michael wrote: > ... I will say that if there were no legacy I'd prefer the tounicode() > and tostring() (but shouldn't itbe 'tobytes()' instead?) names for Python 3.0. Wouldn't 'tobytes' and 'totext' be better for 3.0 where text == unicode? -- -- Scott David Daniels [EMAIL PROTECTED]

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Bill Janssen
> Huh... just joining here but surely you don't mean a text string that > doesn't use every character available in a particular encoding is > "really bytes"... it's still a text string... No, once it's in a particular encoding it's bytes, no longer text. As you say, > Keep these two concepts sepa

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-01 Thread Walter Dörwald
[EMAIL PROTECTED] wrote: > Zitat von Ulrich Berning <[EMAIL PROTECTED]>: > >> I can't see many advantages in moving to C++, but a lot of disadvantages: > > There are a few advantages, though, mainly: > - increased type-safety, in particular for API that isn't type-checked > at all at the momen

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-01 Thread martin
Zitat von Ulrich Berning <[EMAIL PROTECTED]>: > I can't see many advantages in moving to C++, but a lot of disadvantages: There are a few advantages, though, mainly: - increased type-safety, in particular for API that isn't type-checked at all at the moment (e.g. PyArg_ParseTuple) - more reliab

Re: [Python-Dev] Making staticmethod objects callable?

2006-03-01 Thread Steven Bethard
On 3/1/06, Nicolas Fleury <[EMAIL PROTECTED]> wrote: > Basically, should staticmethods be made callable so that the following > would not raise an exception: > > class A: > @staticmethod > def foo(): pass > bar = foo() > > There's workarounds, but it's really just about usability. s

Re: [Python-Dev] Stateful codecs [Was: str object going in Py3K]

2006-03-01 Thread M.-A. Lemburg
Walter Dörwald wrote: > M.-A. Lemburg wrote: >> Walter Dörwald wrote: >>> Hye-Shik Chang wrote: >>> On 2/19/06, Walter Dörwald <[EMAIL PROTECTED]> wrote: > M.-A. Lemburg wrote: >> Walter Dörwald wrote: >>> Anyway, I've started implementing a patch that just adds >>> codecs.Stat

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Chermside, Michael
Ron Adam writes: > While playing around with the example bytes class I noticed code reads > much better when I use methods called tounicode and tostring. [...] > I'm not suggesting we start using to-type everywhere, just where it > might make things clearer over decode and encode. +1 I alwa

Re: [Python-Dev] Stateful codecs [Was: str object going in Py3K]

2006-03-01 Thread Walter Dörwald
Anthony Baxter wrote: > On Thursday 02 March 2006 01:48, Walter Dörwald wrote: >> Any progress on this? I'd really like to get this into 2.5 and the >> feature freeze is approaching fast! > > Remember, the feature freeze is as of beta1. Hopefully the major new > features are all going to be in be

Re: [Python-Dev] Stateful codecs [Was: str object going in Py3K]

2006-03-01 Thread Anthony Baxter
On Thursday 02 March 2006 01:48, Walter Dörwald wrote: > Any progress on this? I'd really like to get this into 2.5 and the > feature freeze is approaching fast! Remember, the feature freeze is as of beta1. Hopefully the major new features are all going to be in before alpha1, but they can contin

[Python-Dev] Making staticmethod objects callable?

2006-03-01 Thread Nicolas Fleury
Hi, I've posted this question on comp.lang.python, but nobody seems to conclude it is a bad idea, so I post it here. http://groups.google.com/group/comp.lang.python/browse_frm/thread/6082dae1deef9161/88bb8a26750dd8c6?lnk=raot&hl=en#88bb8a26750dd8c6 Basically, should staticmethods be made callabl

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Ron Adam
Nick Coghlan wrote: > All the unicode codecs, on the other hand, use encode to get from characters > to bytes and decode to get from bytes to characters. > > So if bytes objects *did* have an encode method, it should still result in a > unicode object, just the same as a decode method does (beca

Re: [Python-Dev] Stateful codecs [Was: str object going in Py3K]

2006-03-01 Thread Walter Dörwald
M.-A. Lemburg wrote: > Walter Dörwald wrote: >> Hye-Shik Chang wrote: >> >>> On 2/19/06, Walter Dörwald <[EMAIL PROTECTED]> wrote: M.-A. Lemburg wrote: > Walter Dörwald wrote: >> Anyway, I've started implementing a patch that just adds >> codecs.StatefulEncoder/codecs.StatefulDecod

Re: [Python-Dev] Proposal: defaultdict

2006-03-01 Thread Gareth McCaughan
> >> d.get(key, [], True).append(value) > > > > hmm. are you sure you didn't just reinvent setdefault ? > > I'm reasonably sure I copied it on purpose, only with a name that isn't 100% > misleading as to what it does ;) Heh. From the original Usenet posting that suggested the capability that

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Nick Coghlan
Bill Janssen wrote: > Greg Ewing wrote: >> Bill Janssen wrote: >> >>> bytes -> base64 -> text >>> text -> de-base64 -> bytes >> It's nice to hear I'm not out of step with >> the entire world on this. :-) > > Well, I can certainly understand the bytes->base64->bytes side of > thing too. The "text"

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-01 Thread Barry Warsaw
On Feb 28, 2006, at 6:26 PM, Fredrik Lundh wrote: > > should we perhaps switch to (careful use of) C++ in 3.0 ? I hope not. It would make life more difficult for embedded/extended users like ourselves because it would force us to link our applications as C++ programs. That introduces lots o

Re: [Python-Dev] bytes.from_hex()

2006-03-01 Thread Donovan Baarda
On Tue, 2006-02-28 at 15:23 -0800, Bill Janssen wrote: > Greg Ewing wrote: > > Bill Janssen wrote: > > > > > bytes -> base64 -> text > > > text -> de-base64 -> bytes > > > > It's nice to hear I'm not out of step with > > the entire world on this. :-) > > Well, I can certainly understand the byte

Re: [Python-Dev] C++ for CPython 3? (Re: str.count is slow)

2006-03-01 Thread Wolfgang Langner
Hello, > >should we perhaps switch to (careful use of) C++ in 3.0 ? > I can't see many advantages in moving to C++, but a lot of disadvantages: > > - Size increase, especially when we start using templates > - Performance decrease > - Problems with name mangling together with dynamic loading and c

Re: [Python-Dev] .py and .txt files missing svn:eol-style in trunk

2006-03-01 Thread Oleg Broytmann
On Wed, Mar 01, 2006 at 12:17:16AM -0600, Tim Peters wrote: > These .py and .txt files don't have the svn:eol-style property set. > I'm not sure they all _should_, though. My experience shows that if the developers use different OSes (our team uses Linux and Windows) it helps very much to set