On 31Jan2010 16:23, Kyp wrote:
| On Jan 31, 2:44 pm, Peter Otten <__pete...@web.de> wrote:
| > Kyp wrote:
| > > I have a dir with a large # of files that I need to perform operations
| > > on, but only needing to access a subset of the files, i.e. the first
| > > 100 files.
| > > Using glob is ver
On Jan 31, 2:44 pm, Peter Otten <__pete...@web.de> wrote:
> Kyp wrote:
> > I have a dir with a large # of files that I need to perform operations
> > on, but only needing to access a subset of the files, i.e. the first
> > 100 files.
>
> > Using glob is very slow, so I ran across iglob, which retur
On Jan 31, 1:06 pm, John Bokma wrote:
> Kyp writes:
> > Is there a way to get the first X # of files from a dir with lots of
> > files, that does not take a long time to run?
>
> Assuming Linux: what does time
>
> ls thedir | head
>
> give?
>
> with thedir the name of the actual dir
about 3 seco
Kyp stsci.edu> writes:
> So the iglob was faster, but accessing the first file took about the
> same time as glob.glob.
That would be because glob is implemented in terms of iglob.
--
http://mail.python.org/mailman/listinfo/python-list
Kyp wrote:
> I have a dir with a large # of files that I need to perform operations
> on, but only needing to access a subset of the files, i.e. the first
> 100 files.
>
> Using glob is very slow, so I ran across iglob, which returns an
> iterator, which seemed just like what I wanted. I could it
Kyp writes:
> Is there a way to get the first X # of files from a dir with lots of
> files, that does not take a long time to run?
Assuming Linux: what does time
ls thedir | head
give?
with thedir the name of the actual dir
Also how many is many files?
--
John Bokma
> So the iglob was faster, but accessing the first file took about the
> same time as glob.glob.
I'll wager most of the time required to access the first file is due
to filesystem overhead, not any inherent limitation in Python.
Skip Montanaro
--
http://mail.python.org/mailman/listinfo/python-