Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Yield statement question
#2
"Yield" is useful in separating concerns. It separates the code that creates a collection of similar entities from the code that uses this collection. You can decide to print these items or store them in a container or whatever, but the function that generates the items doesn't need to know what you are going to do with them. Its sole responsibility is the production of these items.
Reply


Messages In This Thread
Yield statement question - by DPaul - Sep-26-2020, 08:12 AM
RE: Yield statement question - by Gribouillis - Sep-26-2020, 11:43 AM
RE: Yield statement question - by ndc85430 - Sep-26-2020, 11:59 AM
RE: Yield statement question - by DPaul - Sep-26-2020, 02:45 PM
RE: Yield statement question - by Gribouillis - Sep-26-2020, 03:00 PM
RE: Yield statement question - by DPaul - Sep-26-2020, 05:18 PM
RE: Yield statement question - by perfringo - Sep-26-2020, 04:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  yield from akbarza 4 565 Apr-19-2024, 07:58 PM
Last Post: DeaD_EyE
  question of using not in if statement and .. akbarza 3 588 Feb-29-2024, 08:40 AM
Last Post: Gribouillis
  yield usage as statement or expression akbarza 5 1,032 Oct-23-2023, 11:43 AM
Last Post: Gribouillis
  Using list comprehension with 'yield' in function tester_V 5 1,541 Apr-02-2023, 06:31 PM
Last Post: tester_V
  Yield generator weird output Vidar567 8 3,479 Nov-23-2020, 10:59 PM
Last Post: deanhystad
  Trying to access next element using Generator(yield) in a Class omm 2 2,129 Oct-19-2020, 03:36 PM
Last Post: omm
  Problem about yield, please help!! cls0724 5 3,076 Apr-08-2020, 05:37 PM
Last Post: deanhystad
  does yield support variable args? Skaperen 0 1,749 Mar-03-2020, 02:44 AM
Last Post: Skaperen
  generator function that yield from a list buran 9 4,456 Jun-04-2019, 10:26 PM
Last Post: snippsat
  yield help chakox 5 3,430 Apr-13-2019, 09:42 PM
Last Post: chakox

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020