Skip to content

Conversation

stevendes
Copy link
Owner

Completed and ready for review!

@stevendes stevendes requested a review from glpuga January 3, 2020 15:52
Copy link
Collaborator

@glpuga glpuga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, some questions for you to answer.

self.assertEqual(__, attempt1)
self.assertEqual(__, attempt2)
self.assertEqual(['Boom!', 'Boom!', 'Boom!'], attempt1)
self.assertEqual([], attempt2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this?

#
# Hint: Read the "Specification: Sending Values into Generators"
# section of http://www.python.org/dev/peps/pep-0342/
#I think is because the generator has just been created so it's not prepared yet to receive a value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's right.

for bacon in bacon_generator:
result.append(bacon)
self.assertEqual(__, result)
self.assertEqual(['crunchy bacon', 'veggie bacon', 'danish bacon'], result)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Research about tuple generators and tell me what you find.

generator = self.yield_tester()

next(generator)
# 'next(generator)' is exactly equivalent to 'generator.send(None)'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants