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.
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()
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
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
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
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.
> >
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
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
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
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
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.
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]
>
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
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
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
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
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
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
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
> 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
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
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
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
>>
>> [...]
>>
"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
-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
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
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
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
>
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
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
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
> 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
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
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
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
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
___
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
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
> 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
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. :)
> >
> >
40 matches
Mail list logo