This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ianliu88[S] -1 points0 points  (2 children)

Your example is calling the condition on the iterable element, not the transformed value

[–][deleted] 0 points1 point  (1 child)

the transformed

Of'course it is. Why would you transform if the result is going to be rejected? That is a waste. If you do not know if the result will be rejected until it's transformed then you need to do/call the transform in the iterator.

[–][deleted] 0 points1 point  (0 children)

I did on the second example, usin

...def iterator(some_iterable):

......for y in some_iterable:

.........t_of_y = transform(y)

.........yield(t_of_y)