{"id":8080,"date":"2021-01-24T19:24:10","date_gmt":"2021-01-24T13:54:10","guid":{"rendered":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/?p=8080"},"modified":"2022-10-21T11:16:34","modified_gmt":"2022-10-21T05:46:34","slug":"python__new__","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/","title":{"rendered":"Python __new__ Explained With Examples"},"content":{"rendered":"\n<p>Hello geeks and welcome in today&#8217;s article we will cover <strong>Python new<\/strong>. Along with that, we will look at the <strong>definition and application<\/strong> of this method. We will do all that with the help of examples. As we know that python is a<strong> high-level programming language<\/strong>. With the help of it, we can also do <strong>object-oriented programming<\/strong>. In Python, there are several special methods know as <strong>magic methods<\/strong> or <strong>double underscore <\/strong>methods. They have been commonly used methods in <strong>operator overloading<\/strong>. It can be understood as a condition where the different operators have different implementations depending on their arguments.<\/p>\n\n\n\n<p>The other thing that differentiates the magical method from the common method is that they <strong>have suffixes and prefixes of double underscore around them<\/strong>. Like <strong>__new__<\/strong> , <strong>__add__<\/strong>, <a href=\"https:\/\/www.pythonpool.com\/init-python\/\">__init__<\/a> and etc. In this article, we will primarily focus on the magical method __new__. <strong>Further in this article, I will use new instead of __new__.<\/strong><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#Python_new_method_and_its_syntax\" title=\"Python __new__ method and its syntax\">Python __new__ method and its syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#Syntax\" title=\"Syntax\">Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#Examples_of_Python_new\" title=\"Examples of Python __new__\">Examples of Python __new__<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#Difference_Between_Python_new_and_init_magic_methods\" title=\"Difference Between Python __new__ and __init__ magic methods\">Difference Between Python __new__ and __init__ magic methods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#Python_new_with_arguments\" title=\"Python __new__ with arguments\">Python __new__ with arguments<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#See_Also\" title=\"See Also\">See Also<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#References\" title=\"References\">References<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-python-new-method-and-its-syntax\"><span class=\"ez-toc-section\" id=\"Python_new_method_and_its_syntax\"><\/span>Python __new__ method and its syntax<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this section, we will try to understand what the new method really is. Along with that, we will also look at its <strong>syntax<\/strong>. To develop a complete understanding of this method.<\/p>\n\n\n\n<p>In object-oriented programming <strong>whenever a class has instantiated<\/strong> the <strong>method new<\/strong> is called. The new method is called when an object is created and is a<strong> static method<\/strong>. A <strong>parameter cls. cls<\/strong> is required to pass through it. At the time of instantiation, the compiler itself takes care of it. Next, let us look at the syntax for this method. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-syntax\"><span class=\"ez-toc-section\" id=\"Syntax\"><\/span>Syntax<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nclass class_name:\n    def __new__(cls, *args, **kwargs):\n        print()\n        return super(class_name, cls).__new__(cls, *args, **kwargs)\n<\/pre><\/div>\n\n\n<p>This is the general syntax of the new method. Here we have used the <strong>super<\/strong> with our <strong>return statement<\/strong>. We use it because it returns a <strong>temporary object<\/strong> and allows us to access the methods of the base class. In the next let us look at some examples related to it. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-examples-of-python-new\"><span class=\"ez-toc-section\" id=\"Examples_of_Python_new\"><\/span>Examples of Python __new__<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nclass A(object): \n    def __new__(cls): \n         print(&quot;EXAMPLE-1&quot;) \n         return super(A, cls).__new__(cls) \n  \nA()\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXAMPLE-1<\/code><\/pre>\n\n\n\n<p id=\"h-\"> Above we can see the very first example related to the new method. Here we have done nothing fancy and only motive was to execute syntax properly. Here we defined an object. Inside it, we have defined a new class. Then we have used a simple print and return super. At last, we just call the object. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport math\nclass A(object): \n    def __new__(cls): \n         a=input(&quot;enter the number&quot;)\n         b=input(&quot;enter the number&quot;)\n         c=int(a)+int(b)\n         print(c)\n         \n         return super(A, cls).__new__(cls) \n  \nA()\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>enter the number 7\nenter the number 9\n16<\/code><\/pre>\n\n\n\n<p>In this example, we have carried out the addition of 2 numbers. Here we have taken the input from the user. Rest we have just followed the concerned syntax. From the above 2 examples discussed, we can conclude that the new method is called automatically. As well as the return super statement should be used when dealing with magic methods. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-difference-between-python-new-and-init-magic-methods\"><span class=\"ez-toc-section\" id=\"Difference_Between_Python_new_and_init_magic_methods\"><\/span>Difference Between Python __new__ and __init__ magic methods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As so far in this article we have discussed the magic method new. The method <strong>__int__<\/strong>  is also <strong>automatically added when a class is instantiated<\/strong>. Here the difference between the 2 is that the <strong>init method is used to initialize the object<\/strong>. Also when both the methods are present in that case <strong>first the execution of the new method takes place<\/strong>. After which it is decided whether to use the init method or not. Let us see an example involving both the methods which will make things a lot clearer to us. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nclass A(object): \n    def __new__(cls): \n         print(&quot;New method&quot;) \n         return super(A, cls).__new__(cls) \n  \n    def __init__(self): \n        print(&quot;Init method &quot;) \n  \nA() \n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>New method\nInit method <\/code><\/pre>\n\n\n\n<p>Above we can see a simple example involving both methods. From this, we can observe another thing which is that the new is called automatically. Whereas for the init it will be called every time at that instance. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-python-new-with-arguments\"><span class=\"ez-toc-section\" id=\"Python_new_with_arguments\"><\/span>Python __new__ with arguments<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>From python 2.6, the developers have ignored the extra arguments from object.__new__ method. This applies to all the python versions that are >2.6. Moreover, from python 3.2, it throws an error by passing arguments in python __new__. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-see-also\"><span class=\"ez-toc-section\" id=\"See_Also\"><\/span>See Also<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links\"><li><a href=\"https:\/\/www.pythonpool.com\/init-python\/\">init Python | Is __init__ in Python a Constructor?<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/python-multiple-constructors\/\">Ways to Achieve Multiple Constructors in Python<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/numpy-argpartition\/\">NumPy argpartition() | Explained with examples<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/matplotlib-font\/\">Pedaling Around with Matplotlib Font<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/nested-classes-python\/\">Nested Classes in Python Explained with Examples<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we covered <strong>Python __new__<\/strong>. We covered a <strong>Magical method<\/strong>, which is called automatically whenever the class is instantiated. We also covered its definition and syntax. To understand the thing properly, we looked at a couple of examples. In the end, we also compared it with another function named init. <\/p>\n\n\n\n<p>I hope this article was able to clear all doubts. But in case you have any unsolved queries feel free to write them below in the comment section. Done reading this, why not read about<a href=\"https:\/\/www.pythonpool.com\/numpy-allclose\/\"> allclose<\/a> next.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-references\"><span class=\"ez-toc-section\" id=\"References\"><\/span>References<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python Documentation. <a href=\"https:\/\/docs.python.org\/3\/reference\/datamodel.html#object.__new__\">Docs.Python.org<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello geeks and welcome in today&#8217;s article we will cover Python new. Along with that, we will look at the definition and application of this &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Python __new__ Explained With Examples\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/python__new__\/#more-8080\" aria-label=\"More on Python __new__ Explained With Examples\">Read more<\/a><\/p>\n","protected":false},"author":11,"featured_media":8202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[3411,3409,3408,3413,3412,1055,3407,3410],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v22.4) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python __new__ Explained With Examples - Python Pool<\/title>\n<meta name=\"description\" content=\"Hello geeks and welcome in todays article we will cover Python new. Along with that, we will look at the definition and application\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/python__new__\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python __new__ Explained With Examples\" \/>\n<meta property=\"og:description\" content=\"Hello geeks and welcome in today&#039;s article we will cover Python new. Along with that, we will look at the definition and application of this method. We\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python__new__\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-24T13:54:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-21T05:46:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rohit Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/\"},\"author\":{\"name\":\"Rohit Kumar\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/664ced779ebbb8ddfd3c58a60d6f9d66\"},\"headline\":\"Python __new__ Explained With Examples\",\"datePublished\":\"2021-01-24T13:54:10+00:00\",\"dateModified\":\"2022-10-21T05:46:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/\"},\"wordCount\":735,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png\",\"keywords\":[\"__new__ python\",\"__new__ python 3\",\"python __new__ arguments\",\"python __new__ constructor\",\"python __new__ example\",\"python __new__ vs __init__\",\"python class attributes __new__\",\"python find __new__ examples\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/python__new__\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/\",\"url\":\"https:\/\/www.pythonpool.com\/python__new__\/\",\"name\":\"Python __new__ Explained With Examples - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png\",\"datePublished\":\"2021-01-24T13:54:10+00:00\",\"dateModified\":\"2022-10-21T05:46:34+00:00\",\"description\":\"Hello geeks and welcome in todays article we will cover Python new. Along with that, we will look at the definition and application\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/python__new__\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png\",\"width\":1350,\"height\":650,\"caption\":\"Python __new__\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/python__new__\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python __new__ Explained With Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/664ced779ebbb8ddfd3c58a60d6f9d66\",\"name\":\"Rohit Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/108d020b4b8cba046952e99dc32190f8?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/108d020b4b8cba046952e99dc32190f8?s=96&d=wavatar&r=g\",\"caption\":\"Rohit Kumar\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python __new__ Explained With Examples - Python Pool","description":"Hello geeks and welcome in todays article we will cover Python new. Along with that, we will look at the definition and application","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:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/","og_locale":"en_US","og_type":"article","og_title":"Python __new__ Explained With Examples","og_description":"Hello geeks and welcome in today's article we will cover Python new. Along with that, we will look at the definition and application of this method. We","og_url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/","og_site_name":"Python Pool","article_published_time":"2021-01-24T13:54:10+00:00","article_modified_time":"2022-10-21T05:46:34+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png","type":"image\/png"}],"author":"Rohit Kumar","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Rohit Kumar","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/"},"author":{"name":"Rohit Kumar","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#\/schema\/person\/664ced779ebbb8ddfd3c58a60d6f9d66"},"headline":"Python __new__ Explained With Examples","datePublished":"2021-01-24T13:54:10+00:00","dateModified":"2022-10-21T05:46:34+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/"},"wordCount":735,"commentCount":3,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png","keywords":["__new__ python","__new__ python 3","python __new__ arguments","python __new__ constructor","python __new__ example","python __new__ vs __init__","python class attributes __new__","python find __new__ examples"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/","url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/","name":"Python __new__ Explained With Examples - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#primaryimage"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png","datePublished":"2021-01-24T13:54:10+00:00","dateModified":"2022-10-21T05:46:34+00:00","description":"Hello geeks and welcome in todays article we will cover Python new. Along with that, we will look at the definition and application","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/01\/Theatre-Actor-Portfolio-Website-39.png","width":1350,"height":650,"caption":"Python __new__"},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/python__new__\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Python __new__ Explained With Examples"}]},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/twitter.com\/pythonpool","https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#\/schema\/person\/664ced779ebbb8ddfd3c58a60d6f9d66","name":"Rohit Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/secure.gravatar.com\/avatar\/108d020b4b8cba046952e99dc32190f8?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/secure.gravatar.com\/avatar\/108d020b4b8cba046952e99dc32190f8?s=96&d=wavatar&r=g","caption":"Rohit Kumar"}}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/8080"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=8080"}],"version-history":[{"count":31,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/8080\/revisions"}],"predecessor-version":[{"id":24300,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/8080\/revisions\/24300"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/8202"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=8080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=8080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=8080"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20240926040351\/https:\/\/api.w.org\/{rel}","templated":true}]}}