

{"id":29053,"date":"2018-11-22T09:11:11","date_gmt":"2018-11-22T03:41:11","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=27551"},"modified":"2026-04-20T14:55:06","modified_gmt":"2026-04-20T09:25:06","slug":"python-constructor","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-constructor\/","title":{"rendered":"Python Constructor- Parameterized and Non-Parameterized"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In our last Python tutorial, we discussed Python Identifiers. Today, we will learn about __init__(self), the Python Constructor. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Moreover, we will take a look at what we can do for it, and will learn about parameterized and non-parameterized Python Constructors. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, we will learn about object creation and initialization and will investigate if it is possible to overload constructors.\u00a0<\/span><\/p>\n<p>So, let&#8217;s start the Python Constructor tutorial.<\/p>\n<h3>What is a Constructor in Python?<\/h3>\n<p><span style=\"font-weight: 400\">Python Constructor in object-oriented programming with Python is a special kind of method\/function we use to initialize instance members of that class. <\/span><\/p>\n<p><span style=\"font-weight: 400\">We can also use it to ensure we have enough resources. Whenever we create an object of that class, the constructor definition is the first to execute.<\/span><\/p>\n<p>Constructors can also run checks. If some starting value is wrong, you can raise an error early. This prevents broken objects and keeps the program safe.<\/p>\n<p><span style=\"font-weight: 400\">The way to initialize the value of a class attribute without a constructor:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class three:\r\n       val=7\r\n&gt;&gt;&gt; three.val<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">7<\/div>\n<p><span style=\"font-weight: 400\">We can also do this inside class functions:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class three:\r\n       def func(self,val):\r\n              self.val=val\r\n&gt;&gt;&gt; t=three()\r\n&gt;&gt;&gt; t.func(8)\r\n&gt;&gt;&gt; t.val<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">8<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; t.func(6) #Also lets us re-initialize attributes\r\n&gt;&gt;&gt; t.val<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">6<\/div>\n<p><span style=\"font-weight: 400\">Or we can ask the user for input.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class three:\r\n       def __init__(self):\r\n               self.val=input(\"What value?\")\r\n&gt;&gt;&gt; t=three()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\"><span style=\"font-weight: 400\">What value?<\/span><span style=\"font-weight: 400\">8<\/span><\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; t.val<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">&#8216;8&#8217;<\/div>\n<h3>Declaring a Python Constructor<\/h3>\n<h4>1. Object Creation in Python<\/h4>\n<p><span style=\"font-weight: 400\">__new__ is a static class method that lets us control object creation. Whenever we make a call to the class constructor, it makes a call to __new__. <\/span><\/p>\n<p><span style=\"font-weight: 400\">While this is a default function for every class, we can definitely play around with it.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class demo:\r\n       def __new__(self):\r\n              return 'dataflair'\r\n&gt;&gt;&gt; d=demo()\r\n&gt;&gt;&gt; type(d)<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;str&#8217;&gt;<\/div>\n<h4>2. Object Initialization (and self-parameter) in Python<\/h4>\n<p><span style=\"font-weight: 400\">A constructor is essentially a class function with its name surrounded by double underscores (__). We always call it __init__(). <\/span><\/p>\n<p><span style=\"font-weight: 400\">In C++ or Java, a constructor has the same name as its class, but things aren\u2019t the same with Python. Constructors let us initialize an object. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Let\u2019s take an example.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class citrus:\r\n       def __init__(self):\r\n               self.detoxifying=True\r\ndef show(self):\r\n               print(\"I detoxify\") if self.detoxifying==True else print(\"I do not detoxify\")\r\n&gt;&gt;&gt; kumquat=citrus()\r\n&gt;&gt;&gt; kumquat.show()<\/pre>\n<p><strong>Output\u00a0<\/strong><\/p>\n<div class=\"code-output\">I detoxify<\/div>\n<p><span style=\"font-weight: 400\">Now, statement by statement, let\u2019s see what\u2019s happening.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">__init__() is the constructor here.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It takes the <\/span>self-keyword<span style=\"font-weight: 400\"> to tell the interpreter to work with attributes of <\/span><i><span style=\"font-weight: 400\">this<\/span><\/i><span style=\"font-weight: 400\"> object. It should be the <\/span><span style=\"font-weight: 400\">first parameter<\/span><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It takes no parameters.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">When setting <\/span><i><span style=\"font-weight: 400\">detoxifying<\/span><\/i><span style=\"font-weight: 400\"> to true, we use the <\/span>self-keyword<span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">We have another method <\/span><i><span style=\"font-weight: 400\">show(), <\/span><\/i><span style=\"font-weight: 400\">we pass <\/span><i><span style=\"font-weight: 400\">self<\/span><\/i><span style=\"font-weight: 400\"> to this too.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Then, we create an object as kumquat=citrus().<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Finally, we make a call to kumquat.show().<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Together, both __new__ and __init__ form a constructor.<\/span><\/p>\n<h4>3. New Attributes in Python<\/h4>\n<p><span style=\"font-weight: 400\">We can also create a new attribute exclusively for this object and read it when defining values. <\/span><\/p>\n<p><span style=\"font-weight: 400\">There is not much you can do once you have already defined the object.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; kumquat.color='orange'\r\n&gt;&gt;&gt; print(\"I am \",kumquat.color)<\/pre>\n<p><strong>Output\u00a0<\/strong><\/p>\n<div class=\"code-output\">I am \u00a0orange<\/div>\n<h3>Not Declaring a Python Constructor<\/h3>\n<p><span style=\"font-weight: 400\">So what happens when we do not explicitly provide a constructor to a class? Can Python handle it? <\/span><\/p>\n<p><span style=\"font-weight: 400\">Why don\u2019t we try that out?<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class color:\r\n        def show(self):\r\n               print(\"You can see me\")\r\n&gt;&gt;&gt; orange=color()\r\n&gt;&gt;&gt; orange.show()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">You can see me<\/div>\n<p><span style=\"font-weight: 400\">Here, we did not define a constructor, but Python instantiated that object anyway! This must mean it provides a <\/span><span style=\"font-weight: 400\">default constructor<\/span><span style=\"font-weight: 400\"> that shows up when we do not provide any.<\/span><\/p>\n<h3>Types of Python Constructors<\/h3>\n<p><strong>Benefits of using Python constructors:<\/strong><\/p>\n<ul>\n<li><strong>Automatic setup:<\/strong> When you create an object, it runs on its own.<\/li>\n<li><strong>Better control:<\/strong> It helps in checking the data and avoiding the wrong object.<\/li>\n<li><strong>Easy to understand:<\/strong> It makes the code clearer to understand and more organized.<\/li>\n<li><strong>Handles setup tasks:<\/strong> It can automatically perform basic tasks like opening files and more.<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">We observe three types of Constructors in Python, two of which are in our hands. Let\u2019s begin with the one that isn\u2019t.<\/span><\/p>\n<h4>1. Default Constructor in Python<\/h4>\n<p><span style=\"font-weight: 400\">A constructor that Python lends us when we forget to include one. This one does absolutely nothing but instantiates the object; it is an empty constructor- without a body.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class demo:\r\ndef show(self):\r\nprint(\"Thank you for instantiating me :)\")\r\n&gt;&gt;&gt; d=demo()\r\n&gt;&gt;&gt; d.show()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">Thank you for instantiating me \ud83d\ude42<\/div>\n<h4>2. Non- Parameterized Constructor in Python<\/h4>\n<p><span style=\"font-weight: 400\">When we want a constructor to do something but none of that is to manipulate values, we can use a non-parameterized constructor.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Let\u2019s try the previous example with this!<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class demo:\r\n       def __init__(self):\r\n               print(\"Thank you for instantiating me :)\")\r\n&gt;&gt;&gt; d=demo()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">Thank you for instantiating me \ud83d\ude42<\/div>\n<p><span style=\"font-weight: 400\">We can also use this constructor to set values we\u2019ve decided. Watch how.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class demo:\r\n       def __init__(self):\r\n               self.color='red'\r\n               self.drink='tea'\r\n       def hello(self):\r\n               print(f\"Thank you for instantiating me, I'm all {self.color}. Would you like some {self.drink}? :)\")\r\n&gt;&gt;&gt; d=demo()\r\n&gt;&gt;&gt; d.hello()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">Thank you for instantiating me, I&#8217;m all red. Would you like some tea? \ud83d\ude42<\/div>\n<h4>3. Parameterized Constructor in Python<\/h4>\n<p><span style=\"font-weight: 400\">This lets us set custom values for instance variables. We can have any number of these.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class demo:\r\n       def __init__(self,age,country):\r\n               self.age=age\r\n               self.place=country\r\n       def hello(self):\r\n               print(f\"Hello, I am a {self.age}yo from {self.place}\")\r\n&gt;&gt;&gt; d=demo(22,'Romania')\r\n&gt;&gt;&gt; d.hello()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">Hello, I am a 22yo from Romania<\/div>\n<h3>No Constructor Overloading in Python<\/h3>\n<h4>1. More than One Python Constructor<\/h4>\n<p><span style=\"font-weight: 400\">If you give it more than one constructor, that does not lead to constructor overloading in Python.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class one:\r\n       def __init__(self):\r\n               print(\"First constructor\")\r\n       def __init__(self):\r\n               print(\"Second constructor\")\r\n&gt;&gt;&gt; o=one()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">Second constructor<\/div>\n<h4>2. Two Different Kinds of Constructors in Python<\/h4>\n<p><span style=\"font-weight: 400\">Not even if you try two different kinds of constructors:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class one:\r\n        def __init__(self):\r\n                print(\"First constructor\")\r\n        def __init__(self,val):\r\n                self.val=val\r\n                print(\"Second constructor\",val)\r\n&gt;&gt;&gt; o=one()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Traceback (most recent call last):<br \/>\nFile &#8220;&lt;pyshell#58&gt;&#8221;, line 1, in &lt;module&gt;<br \/>\no=one()<br \/>\nTypeError: __init__() missing 1 required positional argument: &#8216;val&#8217;<\/div>\n<p><span style=\"font-weight: 400\">What this means is Python rebinds the name __init__ to the new method. This means the first declaration of this method is inaccessible now. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Internally, __new__ is the constructor that returns a valid and unpopulated object on which to call __init__.<\/span><\/p>\n<h4>3. Using Default Arguments<\/h4>\n<p><span style=\"font-weight: 400\">Even the following piece of code is simply the use of default arguments, not constructor overloading:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; class one:\r\n       def __init__(self,a=1,b=2):\r\n                print(a+b)\r\n&gt;&gt;&gt; o=one(2)<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">4<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; o1=one(2,3)<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">5<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; o2=one()<\/pre>\n<p><strong>Output <\/strong><\/p>\n<div class=\"code-output\">3<\/div>\n<p>So, this was all in the Python Constructor tutorial. Hope you like our explanation.<\/p>\n<h3>Python Interview Questions on Constructor<\/h3>\n<p>1. What is a constructor in Python? Explain with an example.<\/p>\n<p>2. What is the use of a constructor in Python?<\/p>\n<p>3. How many Constructors are there in Python?<\/p>\n<p>4. Can we have 2 Constructors in Python?<\/p>\n<p>5. Can a constructor in Python be private?<\/p>\n<h3><span style=\"font-weight: 400\">Conclusion<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Who knew there was so much to know about constructors in Python?<\/span><\/p>\n<p><span style=\"font-weight: 400\"> We learned about parameterized and non-parameterized Python Constructors, the default Python Constructor, the <\/span>self-keyword<span style=\"font-weight: 400\">, object creation, and object initialization. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, we saw that there is no such thing as constructor overloading in Python.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last Python tutorial, we discussed Python Identifiers. Today, we will learn about __init__(self), the Python Constructor. Moreover, we will take a look at what we can do for it, and will learn&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":42758,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[3635,6145,9091,9129,10444,10445,10903,15095,15671,15860],"class_list":["post-29053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-declaring-a-python-constructor","tag-how-to-declare-a-python-constructor","tag-no-constructor-overloading-in-python","tag-not-declaring-a-python-constructor","tag-python-constructor","tag-python-constructor-tutorial","tag-python-tutorial","tag-types-of-python-constructors","tag-what-is-constructor","tag-what-is-python-constructor"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Constructor- Parameterized and Non-Parameterized - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn what is Constructor in Python with types, syntax and examples, How to declare a Python Constructor, Constructor Overloading etc.\" \/>\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-constructor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Constructor- Parameterized and Non-Parameterized - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn what is Constructor in Python with types, syntax and examples, How to declare a Python Constructor, Constructor Overloading etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-constructor\/\" \/>\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-11-22T03:41:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-20T09:25:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/09\/Python-Constructor-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=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Constructor- Parameterized and Non-Parameterized - DataFlair","description":"Learn what is Constructor in Python with types, syntax and examples, How to declare a Python Constructor, Constructor Overloading etc.","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-constructor\/","og_locale":"en_US","og_type":"article","og_title":"Python Constructor- Parameterized and Non-Parameterized - DataFlair","og_description":"Learn what is Constructor in Python with types, syntax and examples, How to declare a Python Constructor, Constructor Overloading etc.","og_url":"https:\/\/data-flair.training\/blogs\/python-constructor\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-11-22T03:41:11+00:00","article_modified_time":"2026-04-20T09:25:06+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/09\/Python-Constructor-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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Constructor- Parameterized and Non-Parameterized","datePublished":"2018-11-22T03:41:11+00:00","dateModified":"2026-04-20T09:25:06+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/"},"wordCount":955,"commentCount":6,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/09\/Python-Constructor-01.jpg","keywords":["Declaring a Python Constructor","How to declare a Python Constructor","No Constructor Overloading in Python","Not Declaring a Python Constructor","python constructor","Python Constructor tutorial","python tutorial","Types of Python Constructors","what is Constructor","What is Python Constructor"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-constructor\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/","url":"https:\/\/data-flair.training\/blogs\/python-constructor\/","name":"Python Constructor- Parameterized and Non-Parameterized - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/09\/Python-Constructor-01.jpg","datePublished":"2018-11-22T03:41:11+00:00","dateModified":"2026-04-20T09:25:06+00:00","description":"Learn what is Constructor in Python with types, syntax and examples, How to declare a Python Constructor, Constructor Overloading etc.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-constructor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/09\/Python-Constructor-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/09\/Python-Constructor-01.jpg","width":1200,"height":628,"caption":"Python Constructor- Parameterized and Non-Parameterized"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-constructor\/#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 Constructor- Parameterized and Non-Parameterized"}]},{"@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\/29053","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=29053"}],"version-history":[{"count":15,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/29053\/revisions"}],"predecessor-version":[{"id":147704,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/29053\/revisions\/147704"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/42758"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=29053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=29053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=29053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}