Do this as a list comprehension?

Lie Lie.1296 at gmail.com
Sun Jun 8 05:04:40 EDT 2008


On Jun 8, 8:56 am, Mensanator <mensana... at aol.com> wrote:
> On Jun 7, 8:22�pm, John Salerno <johnj... at gmailNOSPAM.com> wrote:
>
> > Mensanator wrote:
> > > What I DID say was that how the builtins actually
> > > work should be understood and it APPEARED that the
> > > OP didn't understand that. Maybe he understood that
> > > all along but his example betrayed no evidence of
> > > that understanding.
>
> > Well, the truth is that I know zip truncates to the shorter of the two
> > arguments,
>
> Ok, sorry I thought otherwise.
>
> > and also in my case the two arguments would always be the
> > same length.
>
> Yes, because you're controlling the source code.
> But since lists are mutable, source code literals
> don't always control the length of the list.

Since when source code literals ever control the length of a list?
What controls the length of the list is the semantic meaning of the
list, in some cases it just makes no sense that the list would ever
have different length.

(snip)



More information about the Python-list mailing list