sandiegopython / intro-to-python

Introduction to Python (2014)
Creative Commons Attribution 4.0 International
28 stars 26 forks source link

Part 4: Inside Out For Loop. #16

Closed riseriyo closed 10 years ago

riseriyo commented 10 years ago

Definition of list comprehension. A bit confusing with statement, "inside-out for loop".

Suggestion: Explain term differently or add more to what you are defining it is as an 'inside-out for loop".

treyhunner commented 10 years ago

@riseriyo mentioned reversed for loop seems more accurate in the simple case (without an if clause in the comprehension).

Some more ideas:

List comprehensions allow you to take a list, do something with each element, and then output a new list with the changed elements. You can also filter out elements.

List comprehensions take in a list and return a new list with every element changed in some way and/or filtered out of the list. By "list" we really mean "tuple", "string", or anything else that you can loop over.

jkrooskos commented 10 years ago

Going through part 4 now. Just fixed a type in sets description and pushed to master.

On Sun, Sep 14, 2014 at 1:38 PM, Trey Hunner notifications@github.com wrote:

@riseriyo https://github.com/riseriyo mentioned reversed for loop seems more accurate in the simple case (without an if clause in the comprehension).

Some more ideas:

List comprehensions allow you to take a list, do something with each element, and then output a new list with the changed elements. You can also filter out elements.

List comprehensions take in a list and return a new list with every element changed in some way and/or filtered out of the list. By "list" we really mean "tuple", "string", or anything else that you can loop over.

— Reply to this email directly or view it on GitHub https://github.com/pythonsd/intro-to-python/issues/16#issuecomment-55538690 .

jkrooskos commented 10 years ago

typo I mean :0) (omission of a word really)

On Sun, Sep 14, 2014 at 1:56 PM, krooskos . krooskos@gmail.com wrote:

Going through part 4 now. Just fixed a type in sets description and pushed to master.

On Sun, Sep 14, 2014 at 1:38 PM, Trey Hunner notifications@github.com wrote:

@riseriyo https://github.com/riseriyo mentioned reversed for loop seems more accurate in the simple case (without an if clause in the comprehension).

Some more ideas:

List comprehensions allow you to take a list, do something with each element, and then output a new list with the changed elements. You can also filter out elements.

List comprehensions take in a list and return a new list with every element changed in some way and/or filtered out of the list. By "list" we really mean "tuple", "string", or anything else that you can loop over.

— Reply to this email directly or view it on GitHub https://github.com/pythonsd/intro-to-python/issues/16#issuecomment-55538690 .

macro1 commented 10 years ago

Appears resolved.