Top "Generator-expression" questions

A syntactic construct in Python providing a concise way to create a generator object, with syntax similar to a list comprehension.

Using while in list comprehension or generator expressions

I can use if and for in list comprehensions/generator expressions as list(i for i in range(100) if i*…

python list-comprehension recipe generator-expression
convert string to dict using list comprehension

I have came across this problem a few times and can't seem to figure out a simple solution. Say I …

python string dictionary list-comprehension generator-expression
List comprehension with condition

I have a simple list. >>> a = [0, 1, 2] I want to make a new list from it using a …

python if-statement list-comprehension generator-expression
Django Custom Queryset filters

Is there, in Django, a standard way to write complex, custom filters for QuerySets? Just as I can write MyClass.…

python django django-queryset generator-expression
yield in list comprehensions and generator expressions

The following behaviour seems rather counterintuitive to me (Python 3.4): >>> [(yield i) for i in range(3)] <generator …

python generator list-comprehension yield generator-expression
Python generator expression if-else

I am using Python to parse a large file. What I want to do is If condition =True append to …

python generator-expression
Generator as function argument

Can anyone explain why passing a generator as the only positional argument to a function seems to have special rules? …

python python-2.7 syntax generator-expression