[Python-ideas] while conditional in list comprehension ?? (original) (raw)
Ian Cordasco graffatcolmingov at gmail.com
Mon Jan 28 16:17:49 CET 2013
- Previous message: [Python-ideas] while conditional in list comprehension ??
- Next message: [Python-ideas] while conditional in list comprehension ??
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 28, 2013 at 9:51 AM, Shane Green <shane at umbrellacode.com> wrote:
Yeah, I realized (1) after a minute and came up with "else break": if n < 400 else break. Could that be functionally equivalent, not based on a loop construct within an iterator?
You mean: [n for n in range(0, 400) if n < 100 else break]? That is
definitely more obvious (in my opinion) than using the while syntax,
but what does break mean in the context of a list comprehension? I
understand the point, but I dislike the execution. I guess coming from
a background in pure mathematics, this just seems wrong for a list (or
set) comprehension.
- Previous message: [Python-ideas] while conditional in list comprehension ??
- Next message: [Python-ideas] while conditional in list comprehension ??
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]