Re: [Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Greg Ewing
Brett Cannon wrote: There is a general dislike in putting code in a package's __init__ module. Why? What's the point of having an __init__.py file if you're not allowed to put any code there? If it's something that applies to the package as a whole, that seems like the obvious place to put it.

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Martin v. Löwis
Guido van Rossum wrote: > There is one use case I can see for an iterator-version of > os.listdir() (to be named os.opendir()): when globbing a huge > directory looking for a certain pattern. Using os.listdir() you end up > needed enough memory to hold all of the names at once. Using > os.opendir()

Re: [Python-3000] Displaying strings containing unicode escapes

2008-04-30 Thread Stephen J. Turnbull
atsuo ishimoto writes: > > And where does Atsuo fall? > > Sorry, I cannot understand word 'fall', perhaps a colloquial expression? In this case, it means "what is your opinion, compared to Stephen and Martin?" > If you mean 'Hey, Atsuo. Hurry up!', then I have just uploaded draft > PEP to

Re: [Python-3000] Displaying strings containing unicode escapes

2008-04-30 Thread atsuo ishimoto
On Thu, May 1, 2008 at 2:36 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I still like this proposal. I don't quite understand the competing (?) > proposal by Stephen Turnbull; perhaps Stephen can compare and contrast > the two proposals? I think Stephen's proposal is not competing to Martin

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Giovanni Bajo
On Wed, 30 Apr 2008 16:02:31 -0700, Guido van Rossum wrote: > There is one use case I can see for an iterator-version of os.listdir() > (to be named os.opendir()): when globbing a huge directory looking for a > certain pattern. Using os.listdir() you end up needed enough memory to > hold all of th

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
As I said before, apparently it is practical in the Java world. On Wed, Apr 30, 2008 at 5:26 PM, Benjamin Peterson <[EMAIL PROTECTED]> wrote: > On Wed, Apr 30, 2008 at 7:16 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > > But I didn't find a rationale. I'm sure it was PBP though. > >

Re: [Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Brett Cannon
On Wed, Apr 30, 2008 at 5:08 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Wed, Apr 30, 2008 at 5:02 PM, Brett Cannon <[EMAIL PROTECTED]> wrote: > > There is a general dislike in putting code in a package's __init__ > > module. Personally I am fine with doing that, but I tried not to do

Re: [Python-3000] range() issues

2008-04-30 Thread Benjamin Peterson
On Wed, Apr 30, 2008 at 7:16 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > But I didn't find a rationale. I'm sure it was PBP though. > > > > What's PBP? (A search only turns up a bicycle race. :)) > > Practicality Beats Purity, from the zen of Python It's practical to have a builti

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 5:10 PM, Benjamin Peterson <[EMAIL PROTECTED]> wrote: > On Wed, Apr 30, 2008 at 6:41 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > I've come across situations where len() raising an exception was more > > inconvenient than returning a truncated value (e.g. when pri

Re: [Python-3000] range() issues

2008-04-30 Thread Benjamin Peterson
On Wed, Apr 30, 2008 at 6:41 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I've come across situations where len() raising an exception was more > inconvenient than returning a truncated value (e.g. when printing). In those cases, shouldn't you be explicit, catch the overflow exception, and

Re: [Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 5:02 PM, Brett Cannon <[EMAIL PROTECTED]> wrote: > There is a general dislike in putting code in a package's __init__ > module. Personally I am fine with doing that, but I tried not to do > that with the reorg. If people speak up in support of this then it can > happen.

Re: [Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Brett Cannon
On Tue, Apr 29, 2008 at 11:33 PM, Joe Smith <[EMAIL PROTECTED]> wrote: > > "Brett Cannon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > > On Tue, Apr 29, 2008 at 2:46 AM, Raymond Hettinger <[EMAIL PROTECTED]> > > wrote: > > > > > > > > > * UserList/UserString [done: 3.0] >

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 4:14 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > > > On Wed, Apr 30, 2008 at 3:49 PM, Greg Ewing <[EMAIL PROTECTED]> > wrote: > > > > > > > > > So that code will silently behave as though the rest of > > > the sequence wasn't there some of the t

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 4:11 PM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > In the bug tracker, Alexander mentioned the possibility of removing > __length__ and __getitem__ support from range() objects in py3k, and > implementing only __length_hint__ instead (leaving range() as a bare-bones > itera

Re: [Python-3000] range() issues

2008-04-30 Thread Greg Ewing
Guido van Rossum wrote: On Wed, Apr 30, 2008 at 3:49 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: So that code will silently behave as though the rest of the sequence wasn't there some of the time? Only if it uses LBYL. I don't understand that. Iteration isn't the only thing one does with sequ

Re: [Python-3000] range() issues

2008-04-30 Thread Nick Coghlan
Greg Ewing wrote: Guido van Rossum wrote: I would like to see the following: - sq_length should return maxsize if the actual value doesn't fit So that code will silently behave as though the rest of the sequence wasn't there some of the time? Can you elaborate on the rationale for this? I'm

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Guido van Rossum
There is one use case I can see for an iterator-version of os.listdir() (to be named os.opendir()): when globbing a huge directory looking for a certain pattern. Using os.listdir() you end up needed enough memory to hold all of the names at once. Using os.opendir() you would need only enough memory

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 3:49 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > I would like to see the following: > > > > - sq_length should return maxsize if the actual value doesn't fit > > > > So that code will silently behave as though the rest of > the sequence wasn't

Re: [Python-3000] range() issues

2008-04-30 Thread Greg Ewing
Guido van Rossum wrote: I would like to see the following: - sq_length should return maxsize if the actual value doesn't fit So that code will silently behave as though the rest of the sequence wasn't there some of the time? Can you elaborate on the rationale for this? I'm having trouble seei

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Martin v. Löwis
> There's a big difference between "not enough memory" and "directory > consumes lots of memory". My company has some directories with several > hundred thousand entries, so using an iterator would be appreciated > (although by the time we upgrade to Python 3.x, we probably will have > fixed that

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
I would like to see the following: - sq_length should return maxsize if the actual value doesn't fit - if __len__ is implemented in Python, it may return a value > maxsize, but calling len() will call sq_length, and the sq_length wrapper that calls __len__ must truncate the value to maxsize - if

Re: [Python-3000] range() issues

2008-04-30 Thread Marcin ‘Qrczak’ Kowalczyk
Dnia 29-04-2008, wto o godzinie 19:36 -0700, Guido van Rossum pisze: > Let's also fix __len__() so that it returns sys.{maxint,maxsize} when > the result doesn't fit in a Py_ssize_t. Is this official? What should sq_length do when the real size doesn't fit in a Py_ssize_t? It should be documented

Re: [Python-3000] gettext

2008-04-30 Thread Torsten Bronger
Hallöchen! Barry Warsaw writes: > On Apr 24, 2008, at 6:18 PM, Guido van Rossum wrote: > >> [...] >> >> -- Forwarded message -- >> From: Benjamin Peterson <[EMAIL PROTECTED]> >> Date: Wed, Apr 23, 2008 at 7:32 AM >> Subject: [Python-3000] gettext >> To: Python 3000 >> >> [...] >>

Re: [Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Joe Smith
"Brett Cannon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Tue, Apr 29, 2008 at 2:46 AM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > * UserList/UserString [done: 3.0] > Note that these were updated and moved to the collections module in Py3.0. Noted. > anydbm

Re: [Python-3000] gettext

2008-04-30 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Apr 24, 2008, at 6:18 PM, Guido van Rossum wrote: Care to comment? Or know who should comment? -- Forwarded message -- From: Benjamin Peterson <[EMAIL PROTECTED]> Date: Wed, Apr 23, 2008 at 7:32 AM Subject: [Python-3000] gettext

Re: [Python-3000] Displaying strings containing unicode escapes

2008-04-30 Thread Guido van Rossum
I still like this proposal. I don't quite understand the competing (?) proposal by Stephen Turnbull; perhaps Stephen can compare and contrast the two proposals? And where does Atsuo fall? On Thu, Apr 17, 2008 at 2:40 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I do think we should use som

Re: [Python-3000] Displaying strings containing unicode escapes

2008-04-30 Thread Guido van Rossum
On Fri, Apr 18, 2008 at 7:35 PM, atsuo ishimoto <[EMAIL PROTECTED]> wrote: > - io.TextIOWrapper doesn't provide interface to change encoding > and error-handler after it was created. This feature is supported > in PEP-3116, but isn't impletented at this time. Will it be > implemented? It sh

Re: [Python-3000] range() issues

2008-04-30 Thread Alexander Belopolsky
On Wed, Apr 30, 2008 at 10:05 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: .. > > > > What would you say to an idea of exposing rangeiter in itertools - say > > itertools.irange(..) function that returns an iterator? > > You're kidding right? If you *want* the iterator, what's wrong with >

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Guido van Rossum
On Wed, Apr 30, 2008 at 7:48 AM, Aahz <[EMAIL PROTECTED]> wrote: > > On Tue, Apr 29, 2008, Guido van Rossum wrote: > > On Tue, Apr 29, 2008 at 8:10 PM, Tim Heaney <[EMAIL PROTECTED]> wrote: > >> > >> Speaking of this, is it too late to lobby for an iterator version of > >> os.listdir? (Perhaps

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Aahz
On Tue, Apr 29, 2008, Guido van Rossum wrote: > On Tue, Apr 29, 2008 at 8:10 PM, Tim Heaney <[EMAIL PROTECTED]> wrote: >> >> Speaking of this, is it too late to lobby for an iterator version of >> os.listdir? (Perhaps listdir would not be the best name. :) >> >> There is one at >> >> http://wxi

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Tue, Apr 29, 2008 at 8:22 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 10:36 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > .. > > There are good reasons for having range() return an Iterable and not > > an Iterator; > > What would you say to an idea of

Re: [Python-3000] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Bill Janssen
> I have an application using the QuickTime portion of the Carbon package > very successfully in recent code (with a primarily Tiger-based user > base), where the higher level Cocoa/ObjC frameworks didn't provide the > necessary functionality under Tiger I've got the same issue for the Spotlight A

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Tue, Apr 29, 2008 at 8:22 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 10:36 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > .. > > There are good reasons for having range() return an Iterable and not > > an Iterator; > > What would you say to an idea of

Re: [Python-3000] range() issues

2008-04-30 Thread Guido van Rossum
On Tue, Apr 29, 2008 at 7:53 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 10:36 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > .. > > There are good reasons for having range() return an Iterable and not > > an Iterator; e.g. > > > > R = range(N) > > for

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Greg Ewing
Martin v. Löwis wrote: Still, Guido's question stands: do you have an actual use case where you would want to stop earlier? It just seems a bit disappointing to me that the underlying OS has the ability to read directories an item at a time, but this is not made available to the Python programm

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Greg Ewing
Tim Heaney wrote: Speaking of this, is it too late to lobby for an iterator version of os.listdir? (Perhaps listdir would not be the best name. :) There was discussion about an opendir() function a while back that would return an iterable, but I don't think anything came of it. -- Greg ___

Re: [Python-3000] range() issues

2008-04-30 Thread Greg Ewing
Alexander Belopolsky wrote: On Tue, Apr 29, 2008 at 10:36 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: .. R = range(N) for i in R: for j in R: You realize that in the snippet above whatever cycles you save by creating R once, you give away by creating iter(R) twice. I'm not so su

Re: [Python-3000] PEP 3108 - stdlib reorg/cleanup

2008-04-30 Thread Ronald Oussoren
On 30 Apr, 2008, at 2:17, Brett Cannon wrote: On Tue, Apr 29, 2008 at 3:03 PM, David Bolen <[EMAIL PROTECTED]> wrote: "Brett Cannon" <[EMAIL PROTECTED]> writes: Also realize all of the right people have been consulted on this stuff (e.g., the web SIG about the urllib package). So please d

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread Martin v. Löwis
> I don't know how compelling it is, but the dirread Plan 9 call to get > a directory listing > (http://plan9.bell-labs.com/magic/man2html/2/dirread) returns only a > subset of the entries in the directory so it effectively acts as an > iterator. All operating system APIs to read directories work

Re: [Python-3000] Removal of os.path.walk

2008-04-30 Thread John Barham
On Tue, Apr 29, 2008 at 8:42 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 8:10 PM, Tim Heaney <[EMAIL PROTECTED]> wrote: > > Speaking of this, is it too late to lobby for an iterator version of > > os.listdir? (Perhaps listdir would not be the best name. :) > > > >