

{"id":7871,"date":"2018-02-13T09:00:00","date_gmt":"2018-02-13T03:30:00","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=7871"},"modified":"2026-04-28T14:42:14","modified_gmt":"2026-04-28T09:12:14","slug":"python-closure","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-closure\/","title":{"rendered":"Python Closure &#8211; How to Define Python Closures Function"},"content":{"rendered":"<p>Previously, we talked about Python closures when we discussed Python Decorators. Time to turn it up a notch.<\/p>\n<p>In this Python Closure tutorial, we\u2019ll learn about Python closures and how to define them. Moreover, we will learn nested functions and nonlocal variables used in Closures.<\/p>\n<p>At last, we cover the benefits &amp; examples of Python closure.<\/p>\n<p>So, let&#8217;s start the Python Closure Tutorial.<\/p>\n<h3>What is Python Closure?<\/h3>\n<p>When we define a function inside of another, the inner function is said to be nested inside the outer one.<\/p>\n<p><strong>Common uses of Python closure:<\/strong><\/p>\n<ul>\n<li><strong>Keeping secrets:<\/strong> A part of the code is kept hidden so that the other part of the code doesn&#8217;t become a mess.<\/li>\n<li><strong>Avoiding classes:<\/strong> It is the simplest way to save data without any requirement for extra setup.<\/li>\n<li><strong>Remembers the past:<\/strong> Even after the original code or value is deleted, the closure remembers the value.<\/li>\n<\/ul>\n<p>Let\u2019s take an example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; def outerfunc(x):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 def innerfunc():\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(x)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 innerfunc()\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n&gt;&gt;&gt; outerfunc(7)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7<\/div>\n<p>If you noticed, innerfunc could read the variable \u2018x\u2019, which is nonlocal to it. And if it must modify \u2018x\u2019, we declare that it\u2019s nonlocal to innerfunc.<\/p>\n<p>We do this the way we saw in our tutorial on Python Namespace and Variable Scope.<\/p>\n<h3>How can we define a Python Closure Function?<\/h3>\n<p>Now that we\u2019ve revised a couple of topics, we can move on to Python 3 closure. Let\u2019s define a closure.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; def outerfunc(x):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 def innerfunc():\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(x)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return innerfunc #Return the object instead of calling the function\r\n&gt;&gt;&gt; myfunc=outerfunc(7)\r\n&gt;&gt;&gt; myfunc()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7<\/div>\n<p>The point to note here is that instead of calling innerfunc here, we returned it (the object).<\/p>\n<p>Once we\u2019ve defined outerfunc, we call it with the argument 7 and store it in the variable myfunc. Okay, we\u2019ve finished executing outerfunc now.<\/p>\n<p>So, when we call myfunc next, how does it remember that \u2018x\u2019 is 7?<\/p>\n<p>This is the point here. A Python 3 closure is when some data gets attached to the code.<\/p>\n<p>So, this value is remembered even when the variable goes out of scope or the function is removed from the namespace.<\/p>\n<p>If we delete outerfunc, myfunc still gives us 7.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; del outerfunc\r\n&gt;&gt;&gt; myfunc()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7<\/div>\n<p>So, we conclude that we have a Python closure when a nested function references a value in its enclosing scope.<\/p>\n<p>These three conditions must be met:<\/p>\n<p>1. We must have a nested function.<\/p>\n<p>2. This nested function must refer to a variable nonlocal to it(a variable in the scope enclosing it).<\/p>\n<p>3. The enclosing scope must return this function.<\/p>\n<h3>Benefits of Python Closure<\/h3>\n<p>While it seems like a very simple concept, a closure in Python 3 helps us in the following ways:<\/p>\n<p>1. With Python closures, we don\u2019t need to use global values. This is because they let us refer to nonlocal variables. A closure then provides some form of data hiding.<\/p>\n<p>2. When we have only a few Python methods (usually, only one), we may use a Python 3 closure instead of implementing a class for that. This makes it easier on the programmer.<\/p>\n<p>3. A closure lets us implement a Python decorator.<\/p>\n<p>4. A closure lets us invoke a Python function outside its scope.<\/p>\n<h3>More Examples of Python Closure<\/h3>\n<p>Before we say goodbye for today, let\u2019s take a couple more examples of closure in python.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; def outer(x):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 result=0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 def inner(n):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 nonlocal result\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 while n&gt;0:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 result+=x*n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 n-=1\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return result\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return inner\r\n&gt;&gt;&gt; myfunc=outer(7)\r\n&gt;&gt;&gt; myfunc(3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">42<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; myfunc=outer(3)\r\n&gt;&gt;&gt; myfunc(3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">18<\/div>\n<p>In this example, we declare the result to be nonlocal, and we return it from the inner. And then, we return inner from outer. Time for another example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; def outer(func):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 def inner(msg):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 func(msg)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return inner\r\n&gt;&gt;&gt; def sayhi(msg):\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(msg)\r\n&gt;&gt;&gt; myfunc=outer(sayhi)\r\n&gt;&gt;&gt; myfunc(\"Hello\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Hello<\/div>\n<p>Here, we passed a function object to the outer.<\/p>\n<h3>Python Interview Questions on Closures<\/h3>\n<p>1. What are closures in Python?<\/p>\n<p>2. What are closures used for in Python?<\/p>\n<p>3. What are the advantages and disadvantages of using closures in Python?<\/p>\n<p>4. Give an example of a Python closure.<\/p>\n<p>5. How does Python closure work?<\/p>\n<h3>Conclusion<\/h3>\n<p>A closure is a function that remembers the state of its enclosing scope even after that outer function has finished running. When the inner function uses variables defined outside but not global, Python stores them in a cell object tied to the inner function. This lets you build simple factories like make_multiplier(n) that return a new function multiplying inputs by n, without classes.<\/p>\n<p>Closures keep data private and safe from external edits, yet make it available on each call. They pair well with decorators and callbacks, carrying context without global clutter.<\/p>\n<p>Furthermore, if you have any queries, feel free to ask in the comments section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Previously, we talked about Python closures when we discussed Python Decorators. Time to turn it up a notch. In this Python Closure tutorial, we\u2019ll learn about Python closures and how to define them. Moreover,&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":7874,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[1783,2579,10418,10419,10420,10421,10422,10423,10424],"class_list":["post-7871","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-benefits-of-python-closures","tag-closures-in-python","tag-python-closure-tutorial","tag-python-closures","tag-python-closures-advantages","tag-python-closures-decorator","tag-python-closures-examples","tag-python-closures-local-variable","tag-python-closures-nested-function"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Closure - How to Define Python Closures Function - DataFlair<\/title>\n<meta name=\"description\" content=\"Python Closure Tutorial- Learn closures Function in python, python closures nonlocal variable &amp; nested function, Advantages &amp; Examples of Python closure\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-closure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Closure - How to Define Python Closures Function - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python Closure Tutorial- Learn closures Function in python, python closures nonlocal variable &amp; nested function, Advantages &amp; Examples of Python closure\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-closure\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-13T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-28T09:12:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Closures-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Closure - How to Define Python Closures Function - DataFlair","description":"Python Closure Tutorial- Learn closures Function in python, python closures nonlocal variable & nested function, Advantages & Examples of Python closure","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-closure\/","og_locale":"en_US","og_type":"article","og_title":"Python Closure - How to Define Python Closures Function - DataFlair","og_description":"Python Closure Tutorial- Learn closures Function in python, python closures nonlocal variable & nested function, Advantages & Examples of Python closure","og_url":"https:\/\/data-flair.training\/blogs\/python-closure\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-02-13T03:30:00+00:00","article_modified_time":"2026-04-28T09:12:14+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Closures-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-closure\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Closure &#8211; How to Define Python Closures Function","datePublished":"2018-02-13T03:30:00+00:00","dateModified":"2026-04-28T09:12:14+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-closure\/"},"wordCount":711,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Closures-01.jpg","keywords":["Benefits of Python closures","Closures in Python","Python closure tutorial","Python Closures","Python closures advantages","Python closures decorator","Python Closures Examples","Python closures local variable","Python closures nested function"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-closure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-closure\/","url":"https:\/\/data-flair.training\/blogs\/python-closure\/","name":"Python Closure - How to Define Python Closures Function - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Closures-01.jpg","datePublished":"2018-02-13T03:30:00+00:00","dateModified":"2026-04-28T09:12:14+00:00","description":"Python Closure Tutorial- Learn closures Function in python, python closures nonlocal variable & nested function, Advantages & Examples of Python closure","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-closure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Closures-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-Closures-01.jpg","width":1200,"height":628,"caption":"what is Python Closure"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-closure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Closure &#8211; How to Define Python Closures Function"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=7871"}],"version-history":[{"count":12,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7871\/revisions"}],"predecessor-version":[{"id":148013,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7871\/revisions\/148013"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/7874"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=7871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=7871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=7871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}