{"id":4345,"date":"2021-06-05T19:25:52","date_gmt":"2021-06-05T13:55:52","guid":{"rendered":"https:\/\/blog.guvi.in\/?p=4345"},"modified":"2026-02-04T12:45:30","modified_gmt":"2026-02-04T07:15:30","slug":"understanding-the-yield-keyword-in-python","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/understanding-the-yield-keyword-in-python\/","title":{"rendered":"What Does the yield Keyword In Python Do?"},"content":{"rendered":"\n<p><span style=\"font-weight: 400;\">If you are a beginner and have recently started learning to program then you must have come across the \u2018<\/span><b>yield<\/b><span style=\"font-weight: 400;\">\u2019 keyword in Python.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">There is a big possibility that you might feel confused about what it is! On the other hand, you might already know about it, then the other question that could arise in your mind is why use the \u2018<\/span><b>yield<\/b><span style=\"font-weight: 400;\">\u2019 keyword in python when we can use the \u2018<\/span><b>return<\/b><span style=\"font-weight: 400;\">\u2019 keyword.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">This curiosity of yours has brought you to the right place. Because in this article we will be reading about the \u2018yield\u2019 keyword in Python. Thereby we will try to understand the scenarios when the usage of the \u2018yield\u2019 keyword can be beneficial to us as a programmer. We will eventually understand why we need to use the \u2018yield\u2019 keyword instead of using the \u2018return\u2019 keyword. Apart from this, we will also be introducing you to the concept of <\/span><b>generators<\/b><span style=\"font-weight: 400;\"> in Python.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">One of the biggest dilemmas a beginner will ever come across in Python language is when to use the \u2018return\u2019 keyword and when to use the \u2018yield\u2019 keyword. Provided you know that both of these are used to return some value out of a function.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The above statement can be more accurately stated as:<\/span><\/p>\n\n\n\n<p><b><i>the \u2018yield\u2019 keyword in python is used to make generator functions and usually returns generator objects.<\/i><\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Now, you must be wondering what exactly a <\/span><b>generator<\/b><span style=\"font-weight: 400;\"> function is. We\u2019ll discuss it in the upcoming section.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><em><b>Generators in Python<\/b><\/em><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">A <a href=\"https:\/\/wiki.python.org\/moin\/Generators\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/wiki.python.org\/moin\/Generators\" rel=\"noreferrer noopener nofollow\">generator function<\/a> is just like a normal function that is used to return some values but instead of using the usual <\/span><b>return<\/b><span style=\"font-weight: 400;\"> keyword, we make use of the <\/span><b>yield<\/b><span style=\"font-weight: 400;\"> keyword to return the value in the function.&nbsp; The values returned are generated spontaneously. If the body of a user-defined function contains the <\/span><b>yield<\/b><span style=\"font-weight: 400;\"> keyword, that function automatically acts as a generator function.&nbsp;<\/span><\/p>\n\n\n\n<p>As soon as the \u2018yield\u2019 keyword is executed inside the function, it yields back a generator object. The generator object is iterable in nature. Also, it could be iterated only once as the items are produced randomly by the generator. These values are not stored fully in memory. Thereafter, the control of the function returns <span style=\"font-weight: 400;\">to the caller.&nbsp;<\/span><\/p>\n\n\n\n<p><em>Before diving into the next section, ensure you&#8217;re solid on Python essentials from basics to advanced-level. If you are looking for a detailed Python career program, you can join <strong><a href=\"https:\/\/www.guvi.in\/zen-class\/python-course\/?utm_source=blog&amp;utm_medium=organic&amp;utm_campaign=yield-Keyword-In-Python\" target=\"_blank\" rel=\"noreferrer noopener\">HCL GUVI\u2019s Python Career Program<\/a> <\/strong>with placement assistance. You will be able to master the Multiple Exceptions, classes, OOPS concepts, dictionary, and many more, and build real-life projects.<\/em><\/p>\n\n\n\n<p><em>Also, if you would like to explore Python through a Self-paced course, try <a href=\"https:\/\/www.guvi.in\/courses\/programming\/python\/?utm_source=blog&amp;utm_medium=organic&amp;utm_campaign=yield-Keyword-In-Python\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>HCL GUVI\u2019s Python Self Paced course<\/strong><\/a>.<\/em><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">We can print the items produced by the generator by either calling the <\/span><a href=\"https:\/\/www.guvi.in\/blog\/how-can-i-read-input-as-numbersthe-easy-guide\/\"><b>next()<\/b><\/a><span style=\"font-weight: 400;\"> method again and again or by iterating over the generator object using them <\/span><b>for<\/b><span style=\"font-weight: 400;\"> a loop. Inside the generator function, the yield keyword helps to maintain the current state of the local variable in the function. Here, the function when called again starts executing from the last yield statement. It is beneficial as it doesn\u2019t use much memory and also saves a lot of computational time.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><em><b>Syntax of a generator function<\/b><\/em><\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1024\" height=\"336\" src=\"http:\/\/blog.guvi.in\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python1-1024x336.png\" alt=\"syntax of generator function -  yield keyword in python\" class=\"wp-image-4347\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python1-1024x336.png 1024w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python1-300x98.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python1-768x252.png 768w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python1.png 1168w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" title=\"\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">Let\u2019s work on an example to understand the functioning of generator function and yield keyword more clearly. Have a look at the below-given code snippet:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"558\" height=\"504\" src=\"http:\/\/blog.guvi.in\/wp-content\/uploads\/2021\/06\/yield-keyword-2.png\" alt=\"generator function and yield keyword in python\" class=\"wp-image-4349\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-2.png 558w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-2-300x271.png 300w\" sizes=\"(max-width: 558px) 100vw, 558px\" title=\"\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">In the above-written code snippet, we have written a generator function that generates an odd number from a given list of numbers. We can observe the function consists of a yield statement that yields the value \u2018i\u2019.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">When we make a call to the generator function, it returns us a generator object that can be verified by printing the value of the \u2018gen\u2019 variable. As the generator object is iterable we can obtain its value by iterating over it. And for that, we are using the <\/span><b>next()<\/b><span style=\"font-weight: 400;\"> method available in Python that is used to return the next value in an iterator.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Every time we call the next() method over the generator object, it yields a single value. After that, the control goes back to the calling statement. Also, we need to note the point that the value of the local variable \u2018i\u2019 does not get reset as the control flows back to the calling function. Here, the current state of the variable remains intact. And the next item in the generator gets printed.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">As items are being generated on the fly and are not stored in memory, the memory is saved. Also, computation becomes faster because the loop doesn\u2019t need to restart from the beginning again and again. The output of the above-written code is given below.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Output:<\/b><\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"300\" height=\"129\" src=\"http:\/\/blog.guvi.in\/wp-content\/uploads\/2021\/06\/yield-keyword-3-300x129.png\" alt=\"output - yield keyword in python\" class=\"wp-image-4351\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-3-300x129.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-3.png 493w\" sizes=\"(max-width: 300px) 100vw, 300px\" title=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><em><b>Reading the generated values using for loop<\/b><\/em><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">In the above code, we have used the <\/span><b>next()<\/b><span style=\"font-weight: 400;\"> method to read generated values again and again. In this section, we will be using the <\/span><b>for<\/b><span style=\"font-weight: 400;\"> loop to read the values generated by the generator. Let\u2019s rewrite the previous code after making some changes:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"430\" height=\"262\" src=\"http:\/\/blog.guvi.in\/wp-content\/uploads\/2021\/06\/yield-keyword-4.png\" alt=\"generated value using loops - yield keyword in python\" class=\"wp-image-4353\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-4.png 430w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-4-300x183.png 300w\" sizes=\"(max-width: 430px) 100vw, 430px\" title=\"\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">Upon saving and executing the code the output will be generated as:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1024\" height=\"373\" src=\"http:\/\/blog.guvi.in\/wp-content\/uploads\/2021\/06\/yield-keyword-5-1024x373.png\" alt=\"code 1 - yield keyword in python\" class=\"wp-image-4354\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-5-1024x373.png 1024w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-5-300x109.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-5-768x279.png 768w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-5.png 1157w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" title=\"\"><\/figure>\n\n\n\n<p><span style=\"font-weight: 400;\">We can also notice from the output that when we retry to print the items stored inside the generator object in the form of a list, it only prints an empty list.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">This verifies the fact that the items are generated spontaneously and can be iterated\/ read-only once. The items inside the generator object get removed from the memory afterward and are not placed permanently. To read\/view those items once again, we have to again call the generator function.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><em><b>Scenarios where usage of yield keyword in Python is beneficial to a programmer:<\/b><\/em><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Given below are some pointers which discuss the usage of the \u2018yield\u2019 keyword in Python:<\/span><\/p>\n\n\n\n<ul>\n<li><span style=\"font-weight: 400;\">Whenever we want to create a generator function, we can use the \u2018yield\u2019 keyword.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">When we want to generate an iterator sequence but don\u2019t want to store the entire sequence into memory so that memory can be saved.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">To save our computational time because the current state of the local variable is saved and execution resumes from the last yield statement.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">To return data having a really large size.<\/span><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><em><b>yield keyword in Python vs. return&nbsp;keyword in python<\/b><\/em><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">In the following section, we have made a detailed comparison between both of these statements which are placed in the table given below:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><b>return keyword<\/b><\/td><td><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;yield keyword<\/b><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">We usually use the return keyword inside normal user-defined functions.<\/span><\/td><td><span style=\"font-weight: 400;\">We usually use the yield keyword inside the generator function.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">You can use the return keyword to return a specific value in a normal function when the function gets called.<\/span><\/td><td><span style=\"font-weight: 400;\">You can use the yield keyword to return a generator object when the function is called.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">Items returned occupy space in the memory.<\/span><\/td><td><span style=\"font-weight: 400;\">No memory is allocated to the items returned by the yield keyword.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">Items returned can be iterated again and again as they are saved onto memory.<\/span><\/td><td><span style=\"font-weight: 400;\">Items returned can be iterated only once.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">After execution of the return statement inside the function, function execution terminates. And the control flows back to the caller. When we make a call to it again, it starts executing from the beginning.<\/span><\/td><td><span style=\"font-weight: 400;\">It is convenient when the size of the data is small.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">Execution time is less as compared to yield when we perform operations on large data.<\/span><\/td><td><span style=\"font-weight: 400;\">Execution time is faster.<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">It is convenient when the size of data is small.<\/span><\/td><td>\n<p style=\"text-align: left;\"><span style=\"font-weight: 400;\">As memory usage is less, it is very useful when we want to deal with large datasets.<\/span><\/p>\n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><em><b>Test your understanding of the yield keyword in Python covered in this article, attempt these practice questions now:<\/b><\/em><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Question 1. What does the \u2018yield\u2019 statement return in a Python program?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">i. List<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ii. Tuple<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iii. Generator object<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iv. Dictionary<\/span><\/p>\n\n\n\n<p><b>Correct Answer: <\/b><span style=\"font-weight: 400;\">(iii)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The yield statement returns us a generator object.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Question 2. Pick the correct output of the below-given code snippet.<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">def generate(m):<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">&nbsp;yield m+1<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">print(&#8220;Function running&#8221;)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">yield m+2<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">op = generate(100)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">print(next(op))<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">print(next(op))<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">i. 101<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Function running<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">103<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ii. 100<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Function running<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iii. 102<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Function running<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iv. 101<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Function running<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">102<\/span><\/p>\n\n\n\n<p><b>Correct Answer: <\/b><span style=\"font-weight: 400;\">(iv)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">The first print statement execution, makes the local variable hold the value 100. So, firstly, the generator function will yield the value 100+1 = 101. Thereafter, the control flows back to the calling function.&nbsp;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Again after the execution of the second print statement, the generator function resumes from the last yield statement. Thus the print statement will print \u2018Function running\u2019 followed by 102. One must not get confused that the state got changed to 101; the current state of the local variable is still 100, so finally, the print statement prints the value 100+2 = 102.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Question 3. Pick the correct output of the below-given<\/b> code snippet.<\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">def func(x):<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">&nbsp;&nbsp;&nbsp;&nbsp;for i in range(7):<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yield i<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">gen = func(False)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">print(tuple(gen))<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">i. No output is printed<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ii. (0,1,2,3,4,5,6)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iii. [0,1,2,3,4,5,6,7]<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iv. (7,7,7,7,7,7)<\/span><\/p>\n\n\n\n<p><b>Correct Answer: <\/b><span style=\"font-weight: 400;\">(ii) (0,1,2,3,4,5,6)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">False parameters passed inside the func() function will not have any major effect on the execution of the function. The function gets triggered and the execution of the loop goes from 0 to 6 then the generator object is converted into a tuple.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Question 4. Which of these methods do we generally use with the generators?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">i. send()<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ii. dict()<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iii. next()<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iv. both (i) and (iii)<\/span><\/p>\n\n\n\n<p><b>Correct Answer: <\/b><span style=\"font-weight: 400;\">(iv) both (i) and (iii)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">We can use the send() method to send data from the caller to the generator function. We use the next() method to request the generator to return the next value.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Question 5. Which of these is not an example of the advantages of using the \u2018yield\u2019 keyword?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">i. It reduces computational time.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">ii. The yield keyword saves memory.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iii. It helps in making a generator.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">iv. None of these<\/span><\/p>\n\n\n\n<p><b>Correct Answer: <\/b><span style=\"font-weight: 400;\">(iv) None of these<\/span><\/p>\n\n\n\n<p><strong>Also Explore: <a href=\"https:\/\/www.guvi.in\/blog\/do-you-know-how-to-create-variables-in-python\/\" data-type=\"link\" data-id=\"https:\/\/www.guvi.in\/blog\/do-you-know-how-to-create-variables-in-python\/\">Do You Know How To Create Variables In Python?<\/a><\/strong><\/p>\n\n\n\n<p><em>Kickstart your Data Science journey by enrolling in <strong><a href=\"https:\/\/www.guvi.in\/zen-class\/python-course\/?utm_source=blog&amp;utm_medium=organic&amp;utm_campaign=yield-Keyword-In-Python\" target=\"_blank\" rel=\"noreferrer noopener\">HCL GUVI\u2019s Python Career Program<\/a><\/strong> where you will master technologies like multiple exceptions, classes, OOPS concepts, dictionaries, and many more, and build real-life projects.<\/em><\/p>\n\n\n\n<p><em>Alternatively, if you would like to explore Python through a Self-Paced course, try <a href=\"https:\/\/www.guvi.in\/courses\/programming\/python\/?utm_source=blog&amp;utm_medium=organic&amp;utm_campaign=yield-Keyword-In-Python\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>HCL GUVI\u2019s Python Self Paced course<\/strong><\/a><\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are a beginner and have recently started learning to program then you must have come across the \u2018yield\u2019 keyword in Python.&nbsp; There is a big possibility that you might feel confused about what it is! On the other hand, you might already know about it, then the other question that could arise in [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":4346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,717],"tags":[],"views":"5509","authorinfo":{"name":"Archana","url":"https:\/\/www.guvi.in\/blog\/author\/archana\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python-300x184.png","jetpack_featured_media_url":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2021\/06\/yield-keyword-in-python.png","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/4345"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=4345"}],"version-history":[{"count":21,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/4345\/revisions"}],"predecessor-version":[{"id":90807,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/4345\/revisions\/90807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/4346"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=4345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=4345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=4345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}