The Voidspace Techie Blog

Gravatar > "someFunc(x.strip() for x in z if x.strip()) looks nicer than this"

They both look silly to me, though. The DRY principle applies to objects too...

> I need to call normpath

Why? It's not like you have to look at the filenames before you pass them to an API function...


Gravatar "someFunc(x.strip() for x in z if x.strip())" was just an example.

Have you never used a list comprehension as a filter/processor to handle an iterable you are passing into a function ?

If the alternative is creating another interface to the function, this way causes less repition.

"It's not like you have to look at the filenames" - unless you present them back to the user for example. Under what circumstances would you *not* want normpath called ?


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan