{"id":2879,"date":"2021-11-13T15:28:40","date_gmt":"2021-11-13T15:28:40","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=2879"},"modified":"2021-11-13T16:07:47","modified_gmt":"2021-11-13T16:07:47","slug":"python-__new__","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/python-oop\/python-__new__\/","title":{"rendered":"Python __new__"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the Python __new__ method and understand how Python uses it to create a new object.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-python-__new__-method'>Introduction to the Python __new__ method <a href=\"#introduction-to-the-python-__new__-method\" class=\"anchor\" id=\"introduction-to-the-python-__new__-method\" title=\"Anchor for Introduction to the Python __new__ method\">#<\/a><\/h2>\n\n\n\n<p>When you create an instance of a <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-class\/\">class<\/a>, Python first calls the <code>__new__()<\/code> method to create the object and then calls the <code><a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-__init__\/\">__init__()<\/a><\/code> method to initialize the object&#8217;s attributes.<\/p>\n\n\n\n<p>The <code>__new__()<\/code> is a <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-static-methods\/\">static method<\/a> of the <code>object<\/code> class. It has the following signature:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">object.__new__(<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span>, *<span class=\"hljs-title\">args<\/span>, **<span class=\"hljs-title\">kwargs<\/span>)<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The first argument of the <code>__new__<\/code> method is the <code>class<\/code> of the new object that you want to create.<\/p>\n\n\n\n<p>The <code>*args<\/code> and <code>**kwargs<\/code> parameters must match the parameters of the <code>__init__()<\/code> of the class. However, the <code>__new__()<\/code> method does use them.<\/p>\n\n\n\n<p>The <code>__new__()<\/code> method should return a new object of the class. But it doesn&#8217;t have to.<\/p>\n\n\n\n<p>When you define a new class, that class implicitly inherits from the <code>object<\/code> class. It means that you can override the <code>__new__<\/code> static method and do something before and after creating a new instance of the class.<\/p>\n\n\n\n<p>To create the object of a class, you call the <code>super().__new__()<\/code> method.<\/p>\n\n\n\n<p>Technically, you can call the <code>object.__new__()<\/code> method to create an object manually. However, you need to call the <code>__init__()<\/code> yourself manually after. Python will not call the <code>__init__()<\/code> method automatically if you explicitly create a new object using the <code>object.__new__()<\/code> method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-__new__-method-example'>Python __new__ method example <a href=\"#python-__new__-method-example\" class=\"anchor\" id=\"python-__new__-method-example\" title=\"Anchor for Python __new__ method example\">#<\/a><\/h2>\n\n\n\n<p>The following defines the <code>Person<\/code> class with the <code>name<\/code> attribute and create a new instance of the <code>Person<\/code> class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">Person<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, name)<\/span>:<\/span>\n        self.name = name\n\n\nperson = Person(<span class=\"hljs-string\">'John'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In Python, a class is <a href=\"https:\/\/www.pythontutorial.net\/python-built-in-functions\/python-callable\/\">callable<\/a>. When you call the class to create a new object:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">person = Person(<span class=\"hljs-string\">'John'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Python will call the <code>__new__()<\/code> and <code>__init__()<\/code> methods. It&#8217;s equivalent to the following method calls:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">person = object.__new__(Person, <span class=\"hljs-string\">'John'<\/span>)\nperson.__init__(<span class=\"hljs-string\">'John'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following shows the contents of the <code>__dict__<\/code> of the <code>person<\/code> object after calling the <code>__new__()<\/code> and <code>__init__()<\/code> methods:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">person = object.__new__(Person, <span class=\"hljs-string\">'John'<\/span>)\nprint(person.__dict__)\n\nperson.__init__(<span class=\"hljs-string\">'John'<\/span>)\nprint(person.__dict__)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">{}\n{<span class=\"hljs-string\">'name'<\/span>: <span class=\"hljs-string\">'John'<\/span>}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>As you can see clearly from the output, after calling the <code>__new__()<\/code> method, the <code>person.__dict__<\/code> is empty. And after calling the <code>__init__()<\/code> method, the <code>person.__dict__<\/code> contains the <code>name<\/code> attribute with the value &#8216;<code>John'<\/code>.<\/p>\n\n\n\n<p>The following illustrates the sequence which Python calls the <code>__new__<\/code> and <code>__init__<\/code> method when you create a new object by calling the class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">Person<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__new__<\/span><span class=\"hljs-params\">(cls, name)<\/span>:<\/span>\n        print(<span class=\"hljs-string\">f'Creating a new <span class=\"hljs-subst\">{cls.__name__}<\/span> object...'<\/span>)\n        obj = object.__new__(cls)\n        <span class=\"hljs-keyword\">return<\/span> obj\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, name)<\/span>:<\/span>\n        print(<span class=\"hljs-string\">f'Initializing the person object...'<\/span>)\n        self.name = name\n\n\nperson = Person(<span class=\"hljs-string\">'John'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">Creating a new Person object...\nInitializing the person object...<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, Python calls the __new__ method and the __init__ method after that.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='when-using-the-__new__-method'>When using the __new__ method <a href=\"#when-using-the-__new__-method\" class=\"anchor\" id=\"when-using-the-__new__-method\" title=\"Anchor for When using the __new__ method\">#<\/a><\/h2>\n\n\n\n<p>The following example defines the <code>SquareNumber<\/code> class that inherits from the built-in int type:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">SquareNumber<\/span><span class=\"hljs-params\">(int)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__new__<\/span><span class=\"hljs-params\">(cls, value)<\/span>:<\/span>\n        <span class=\"hljs-keyword\">return<\/span> super().__new__(cls, value ** <span class=\"hljs-number\">2<\/span>)\n\n\nx = SquareNumber(<span class=\"hljs-number\">3<\/span>)\nprint(x)  <span class=\"hljs-comment\"># 9<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, the <code>__new__()<\/code> method of the <code>SquareNumber<\/code> class accepts an integer and returns the square number. <code>x<\/code> is an instance of the <code>SquareNumber<\/code> class and also an instance of the <code>int<\/code> built-in type:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">print(isinstance(x, int)) <span class=\"hljs-comment\"># True<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that you cannot do this by using the <code>__init__()<\/code> method because the <code>__init__()<\/code> method of the built-in <code>int<\/code> takes no argument. The following code will result in an error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">SquareNumber<\/span><span class=\"hljs-params\">(int)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, value)<\/span>:<\/span>\n        super().__init__(value ** <span class=\"hljs-number\">2<\/span>)\n\n\nx = SquareNumber(<span class=\"hljs-number\">3<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">TypeError: object.__init__() takes exactly one argument (the instance to initialize)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In practice, you use the <code>__new__()<\/code> method when you want to tweak the object at the instantiated time. <\/p>\n\n\n\n<p>For example, the following defines the <code>Person<\/code> class and uses the <code>__new__<\/code>method to inject the <code>full_name<\/code> attribute to the Person&#8217;s object:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">Person<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__new__<\/span><span class=\"hljs-params\">(cls, first_name, last_name)<\/span>:<\/span>\n        <span class=\"hljs-comment\"># create a new object<\/span>\n        obj = super().__new__(cls)\n\n        <span class=\"hljs-comment\"># initialize attributes<\/span>\n        obj.first_name = first_name\n        obj.last_name = last_name\n\n        <span class=\"hljs-comment\"># inject new attribute<\/span>\n        obj.full_name = <span class=\"hljs-string\">f'<span class=\"hljs-subst\">{first_name}<\/span> <span class=\"hljs-subst\">{last_name}<\/span>'<\/span>\n        <span class=\"hljs-keyword\">return<\/span> obj\n\n\nperson = Person(<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Doe'<\/span>)\nprint(person.full_name)\n\nprint(person.__dict__)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">John Doe\n{<span class=\"hljs-string\">'first_name'<\/span>: <span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'last_name'<\/span>: <span class=\"hljs-string\">'Doe'<\/span>, <span class=\"hljs-string\">'full_name'<\/span>: <span class=\"hljs-string\">'John Doe'<\/span>}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Typically, when you override the <code>__new__()<\/code> method, you don&#8217;t need to define the <code>__init__()<\/code> method because everything you can do in the <code>__init__()<\/code> method, you can do it in the <code>__new__()<\/code> method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>The <code>__new__()<\/code> is a static method of the <code>object<\/code> class.<\/li><li>When you create a new object by calling the class, Python calls the <code>__new__()<\/code> method to create the object first and then calls the <code>__init__()<\/code> method to initialize the object&#8217;s attributes.<\/li><li>Override the <code>__new__()<\/code> method if you want to tweak the object at creation time.<\/li><\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2879\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-oop\/python-__new__\/\"\n\t\t\t\tdata-post-title=\"Python __new__\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2879\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-oop\/python-__new__\/\"\n\t\t\t\tdata-post-title=\"Python __new__\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn about the Python __new__ method and understand how Python uses it to create a new object.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":417,"menu_order":40,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2879","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=2879"}],"version-history":[{"count":0,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2879\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/417"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=2879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}