Pythonic love

justin walters walters.justin01 at gmail.com
Tue Mar 8 12:17:06 EST 2016


Sorry about the top posting. I'm new to mailing lists. I should just reply
to the python-list at python.org address then?

Also, thank you for the generator clarification.
On Mar 8, 2016 9:09 AM, "jmp" <jeanmichel at sequans.com> wrote:

> On 03/08/2016 05:49 PM, justin walters wrote:
>
>> Correct me if I'm wrong, but don't python generators usually use the yield
>> statement so they can be used in list comprehensions?
>>
>
> Hello,
>
> Please don't top post.
>
> Generator expressions are different from generator functions. They are
> both generators but use a different syntax.
>
> generator function:
>
> def func(iterable):
>   for i in iterable: yield i
>
>
> the generator expression version would be
>
> (i for i in iterable)
>
>
> Both have their use cases but everytime you can actually use an generator
> expression, it's probably the correct thing to do.
>
> Cheers,
>
> jm
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list