{"id":78139,"date":"2020-04-08T13:23:29","date_gmt":"2020-04-08T07:53:29","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=78139"},"modified":"2024-08-22T20:26:49","modified_gmt":"2024-08-22T14:56:49","slug":"operator-overloading-in-python","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/","title":{"rendered":"Operator Overloading In Python with Easy Examples"},"content":{"rendered":"<p>In object-oriented programming, there exists this concept called <strong>\u201cPolymorphism\u201d<\/strong>. Polymorphism means <strong>\u201cone action, many forms\u201d<\/strong>. OOP allows objects to perform a <strong>single<\/strong> action in <strong>different<\/strong> ways.<\/p>\n<p>One way of implementing polymorphism is through operator overloading. Operator overloading lets you define how operators behave with user-defined objects, allowing for more intuitive and readable code. In Python, this is achieved through special methods known as magic methods or dunder methods (double underscore methods).<\/p>\n<p>In this Python tutorial, we are going to learn what operator overloading is with examples and also explore various magic methods in Python, such as __add__, __sub__, and __eq__, that enable operator overloading.<\/p>\n<p>This will give you the tools to create classes that interact seamlessly with Python&#8217;s built-in operators.<\/p>\n<h3>What is Operator Overloading in Python?<\/h3>\n<p>Operator overloading is the process of using an operator in different ways depending on the operands. You can change the way an operator in Python works on different data-types.<\/p>\n<p>A very popular and convenient example is the <strong>Addition (+) operator<\/strong>.<\/p>\n<p>Just think how the \u2018+\u2019 operator operates on two numbers and the same operator operates on two strings. It performs <strong>\u201cAddition\u201d<\/strong> on numbers whereas it performs <strong>\u201cConcatenation\u201d<\/strong> on strings.<\/p>\n<p>Operators in Python work for <strong>built-in<\/strong> classes, like <strong>int<\/strong>, <strong>str<\/strong>, <strong>list<\/strong>, etc. But you can extend their <strong>operability<\/strong> such that they work on objects of user-defined classes too.<\/p>\n<p>Let\u2019s try it!<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class bubble:\r\n    def __init__(self, volume):\r\n        self.volume = volume<\/pre>\n<p>We have defined a class bubble which has an <strong>attribute volume<\/strong>. Let\u2019s see what happens when we combine two bubbles. We should get the volume of the combined bubble.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; b1 = bubble(20)\r\n&gt;&gt;&gt; b2 = bubble(30)<\/pre>\n<p>And now let\u2019s add b1 and b2 to merge the bubbles.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; b1 + b2<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">TypeError: unsupported operand type(s) for +: \u2018bubble\u2019 and \u2018bubble\u2019<\/div>\n<p>Clearly this doesn\u2019t work right now. That\u2019s because we haven\u2019t extended its operability yet and it only works on <strong>built-in<\/strong> classes.<\/p>\n<p>So how do we make these operators work on our user-defined class bubble as well? This is where <strong>\u201cmagic methods\u201d<\/strong> come into the picture.<\/p>\n<p>Magic methods in Python are special methods that begin and end with a <strong>double underscore( __ )<\/strong>.<\/p>\n<p>The<strong> __init__()<\/strong> is one such method.<\/p>\n<p>Another magic method at our disposal is the<strong> __str__()<\/strong> method.<\/p>\n<p>The<strong> __str__()<\/strong> method lets you control how an object of your class gets <strong>printed<\/strong>.<\/p>\n<p>So if we add this method to our bubble class and print an object of the class, it should work as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class bubble:\r\n    def __init__(self, volume):\r\n        self.volume = volume\r\n\r\n    def __str__(self):\r\n        return \"volume is \" + str(self.volume)<\/pre>\n<p>Now do this in the terminal:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; b1 = bubble(20)\r\n&gt;&gt;&gt; print(b1)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">volume is 20<br \/>\n&gt;&gt;&gt;<\/div>\n<h3>Overloading \u2018+\u2019 operator<\/h3>\n<p>Lastly, let\u2019s add the block of code which will make the \u2018+\u2019 operator operate on objects of bubble. Turns out, we have a magic method for this too, i.e., the<strong> __add__() method<\/strong>.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class bubble:\r\n    def __init__(self, volume):\r\n        self.volume = volume\r\n\r\n    def __str__(self):\r\n        return \"volume is \" + str(self.volume)\r\n\r\n    def __add__(self, other):\r\n        volume = self.volume + other.volume\r\n        return bubble(volume)<\/pre>\n<p>In addition to<strong> \u2018self\u2019<\/strong>, the __add__() method takes another argument<strong> \u2018other\u2019<\/strong>. The \u2018self\u2019 and \u2018other\u2019 refer to the two objects acting as <strong>operands<\/strong>.<\/p>\n<p>We perform the addition of volumes of \u2018self\u2019 and \u2018other\u2019, and then assign this value to a new variable volume. The method then <strong>returns<\/strong> a new object of the class bubble with volume as its <strong>instance variable<\/strong>.<\/p>\n<p>Let\u2019s create a new object which is the sum of 2 bubbles:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; b1 = bubble(20)\r\n&gt;&gt;&gt; b2 = bubble(30)\r\n&gt;&gt;&gt; b3 = b1 + b2\r\n&gt;&gt;&gt; print(b3)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Volume is 50<\/div>\n<p>Now we can perform an <strong>addition<\/strong> on objects of our class.<\/p>\n<p>Let\u2019s see what happens behind the scenes.<\/p>\n<ul>\n<li>When we add b1 + b2, the interpreter calls b1.__add__(b2).<\/li>\n<li>And b1.__add__(b2) is actually executed as bubble.__add__(b1, b2).<\/li>\n<li>This will then return bubble(50).<\/li>\n<li>So, b3 = b1 + b2 is actually equivalent to b3 = bubble(50).<\/li>\n<\/ul>\n<p>In this way, we can overload other operators as well.<\/p>\n<p>Note that in the case of comparison operators, the magic method will return a <strong>boolean expression<\/strong> as a result of the <strong>comparison<\/strong> and not an <strong>object<\/strong>.<\/p>\n<p>You\u2019ll find various python operators and their magic methods in the table below.<\/p>\n<h3>Magic methods in Python<\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>OPERATOR<\/b><\/td>\n<td><b>EXPRESSION<\/b><\/td>\n<td><b>MAGIC METHOD<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Addition<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 + b2<\/span><\/td>\n<td><b>__add__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Subtraction<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &#8211; b2<\/span><\/td>\n<td><b>__sub__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Multiplication<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 * b2<\/span><\/td>\n<td><b>__mul__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Division<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 \/ b2<\/span><\/td>\n<td><b>__truediv__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Power<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 ** b2<\/span><\/td>\n<td><b>__pow__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Floor division<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 \/\/ b2<\/span><\/td>\n<td><b>__floordiv__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Modulo operator<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 % b2<\/span><\/td>\n<td><b>__mod__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bitwise left shift<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &lt;&lt; b2<\/span><\/td>\n<td><b>__lshift__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bitwise right shift<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &gt;&gt; b2<\/span><\/td>\n<td><b>__rshift__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bitwise NOT<\/span><\/td>\n<td><span style=\"font-weight: 400;\">~b1<\/span><\/td>\n<td><b>__invert__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bitwise AND<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &amp; b2<\/span><\/td>\n<td><b>__and__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bitwise OR<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 | b2<\/span><\/td>\n<td><b>__or__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Bitwise XOR<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 ^ b2<\/span><\/td>\n<td><b>__xor__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Less than<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &lt; b2<\/span><\/td>\n<td><b>__lt__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Less than equal to<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &lt;= b2<\/span><\/td>\n<td><b>__le__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Greater than<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &gt; b2<\/span><\/td>\n<td><b>__gt__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Greater than equal to<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 &gt;= b2<\/span><\/td>\n<td><b>__ge__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Equal to<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 == b2<\/span><\/td>\n<td><b>__eq__()<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Not equal to<\/span><\/td>\n<td><span style=\"font-weight: 400;\">b1 !=\u00a0 b2<\/span><\/td>\n<td><b>__ne__()<\/b><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Wrapping up!<\/h3>\n<p>In this article, we learned to use a very special power that comes with <strong>polymorphism<\/strong> in Python. We learned what is operator <strong>overloading<\/strong> in Python. We also learned how we can extend the <strong>operability<\/strong> of an operator such that it can work on our <strong>user-defined classes<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In object-oriented programming, there exists this concept called \u201cPolymorphism\u201d. Polymorphism means \u201cone action, many forms\u201d. OOP allows objects to perform a single action in different ways. One way of implementing polymorphism is through operator&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":78150,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1053],"tags":[2373,2374,2375,2376,2377],"class_list":["post-78139","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-magic-methods-in-python","tag-operator-overloading-in-python","tag-python-magic-methods","tag-python-operator-overloading","tag-python-operator-overloading-examples"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Operator Overloading In Python with Easy Examples - TechVidvan<\/title>\n<meta name=\"description\" content=\"What is operator overloading in python? Learn in detail with examples. Learn what are magic methods in python and what is their use.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Operator Overloading In Python with Easy Examples - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"What is operator overloading in python? Learn in detail with examples. Learn what are magic methods in python and what is their use.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-08T07:53:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-22T14:56:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/python-operator-overloading.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan 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":"Operator Overloading In Python with Easy Examples - TechVidvan","description":"What is operator overloading in python? Learn in detail with examples. Learn what are magic methods in python and what is their use.","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:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/","og_locale":"en_US","og_type":"article","og_title":"Operator Overloading In Python with Easy Examples - TechVidvan","og_description":"What is operator overloading in python? Learn in detail with examples. Learn what are magic methods in python and what is their use.","og_url":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-04-08T07:53:29+00:00","article_modified_time":"2024-08-22T14:56:49+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/python-operator-overloading.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Operator Overloading In Python with Easy Examples","datePublished":"2020-04-08T07:53:29+00:00","dateModified":"2024-08-22T14:56:49+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/"},"wordCount":791,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/python-operator-overloading.jpg","keywords":["Magic Methods in Python","Operator Overloading in Python","Python Magic Methods","Python Operator Overloading","Python operator overloading examples"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/","url":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/","name":"Operator Overloading In Python with Easy Examples - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/python-operator-overloading.jpg","datePublished":"2020-04-08T07:53:29+00:00","dateModified":"2024-08-22T14:56:49+00:00","description":"What is operator overloading in python? Learn in detail with examples. Learn what are magic methods in python and what is their use.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/python-operator-overloading.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/04\/python-operator-overloading.jpg","width":802,"height":420,"caption":"operator overloading in python"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/operator-overloading-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Operator Overloading In Python with Easy Examples"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/78139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=78139"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/78139\/revisions"}],"predecessor-version":[{"id":447691,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/78139\/revisions\/447691"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/78150"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=78139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=78139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=78139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}