Re: python newbie

2007-11-02 Thread tasjaevan
On Nov 2, 3:35 pm, Jim Hendricks <[EMAIL PROTECTED]> wrote: > > This sounds like an issue of terminology. I understand that I don't > declare variables like I would in C or Java, but that they are > implicitly declared via the first assignment. And the define objects > and bind a name to them mak

Re: Last iteration?

2007-10-12 Thread tasjaevan
On Oct 12, 11:58 am, Florian Lindner <[EMAIL PROTECTED]> wrote: > Hello, > can I determine somehow if the iteration on a list of values is the last > iteration? > > Example: > > for i in [1, 2, 3]: >if last_iteration: > print i*i >else: > print i > > that would print > > 1 > 2 >

List comp bug?

2006-04-13 Thread tasjaevan
I seem to have stumbled across a problem with list comprehensions (or perhaps it's a misunderstanding on my part) [f() for f in [lambda: t for t in ((1, 2), (3, 4))]] is giving me [(3, 4), (3, 4)] The equivalent using a generator expression: [f() for f in (lambda: t for t in ((1, 2),