PEP ? os.listdir enhancement

Andreas Kostyrka andreas at kostyrka.org
Thu Jun 23 05:34:02 EDT 2005


What's wrong with

(os.path.join(d, x) for x in os.listdir(d))

It's short, and easier to understand then some obscure option ;)

Andreas

On Thu, Jun 23, 2005 at 11:05:57AM +0200, Riccardo Galli wrote:
> On Wed, 22 Jun 2005 11:27:06 -0500, Jeff Epler wrote:
> 
> > Why not just define the function yourself?  Not every 3-line function
> > needs to be built in.
> 
> Of course I can code such a function, and I agree with the second
> sentence, but I think that obtaining absolutes path is a task so commonly
> needed that adding a keyword to an existing function would give a plus to
> the library without adding complexity (speaking of number of modules).
> 
> Usually when you use os.listdir do you end using os.path.join to obtain
> absolutes path? I'm interested to know if the task is so common as I
> think, or if I'm wrong.
> 
> Thank you,
> Riccardo
> 
> 
> -- 
> Riccardo Galli
> Sideralis Programs
> http://www.sideralis.net
> -- 
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list