Re: Newbie question about tuples and list comprehensions
- From: Roger Miller <roger.miller@xxxxxxxxxxxx>
- Date: Wed, 25 Jun 2008 16:20:29 -0700 (PDT)
First, I second Matt's comment about using a boring old for loop when
it is the simplest way to express what you want to do. Being Pythonic
is not about using exotic features to scrunch your code down to a cool
one-liner. It is about expressing your intentions in a simple, direct
way. Sometimes comprehensions, generators, etc. help. Sometimes they
only obfuscate.
That said, the *most* Pythonic way to do something is to find the
existing library that already does it. Check out the Image.point()
function in the PIL documentation. You may not need to convert the
image to a list at all.
- Roger
.
- References:
- Newbie question about tuples and list comprehensions
- From: idiolect
- Re: Newbie question about tuples and list comprehensions
- From: Matimus
- Newbie question about tuples and list comprehensions
- Prev by Date: urllib tutorial and help
- Next by Date: Re: Newbie question about tuples and list comprehensions
- Previous by thread: Re: Newbie question about tuples and list comprehensions
- Next by thread: Re: Newbie question about tuples and list comprehensions
- Index(es):
Relevant Pages
|
Loading