Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is Inline Iteration in Python?

"What is Inline Iteration?"
I tried googling this question but all the results are about List Comprehension.
I thought it’s the same thing until I read this comment:

"List comprehensions (not inline iteration) are indeed more optimized than…"

And the answer of this question:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

"What you are using is called a list comprehension in Python, not an inline for-loop (even though it is similar to one)."

These people only mention that they are similar but never explain what the difference is.
Are Inline Iteration and Inline For-Loop the same thing?

>Solution :

From the comments in the Get difference from two lists in Python:

Pol: Someone told me that inline iteration is highly optimized as well…

orlp: List comprehensions (not inline iteration) are indeed more optimized than…

Here orlp is telling pol that was he calls "inline iteration" is correctly called a "list comprehension". "inline iteration" isn’t a thing.


From the answer in Inline for loop

What you are using is called a list comprehension in Python, not an inline for-loop (even though it is similar to one)

I believe that this user is saying that a list comprehension is similar to a for loop. There is no such thing as an "inline for loop", but I see why someone would use that terminology when they don’t know what it is called. Both of the questions you linked have answers that are clarifying the actual terminology we use in Python.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading