{"id":1005,"date":"2023-02-28T18:39:00","date_gmt":"2023-02-28T13:09:00","guid":{"rendered":"https:\/\/geekpython.in\/?p=1005"},"modified":"2023-10-29T10:11:56","modified_gmt":"2023-10-29T04:41:56","slug":"init-and-call-method","status":"publish","type":"post","link":"https:\/\/geekpython.in\/init-and-call-method","title":{"rendered":"__init__ and __call__ In Python &#8211; What Do They Do?"},"content":{"rendered":"\n<p>You may have encountered the methods in Python that are prefixed and suffixed with&nbsp;<strong>double underscores<\/strong>, those methods are called&nbsp;<strong>&#8220;Dunder Methods&#8221;<\/strong>. These methods are also called&nbsp;<strong>&#8220;magic methods&#8221;<\/strong>.<\/p>\n\n\n\n<p><strong>Dunder methods<\/strong>&nbsp;are used to overload specific methods in order to make their behavior unique to that class.<\/p>\n\n\n\n<p>Python has a rich collection of built-in dunder methods and a few are listed below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>__init__<\/strong><\/li>\n\n\n\n<li><strong>__call__<\/strong><\/li>\n\n\n\n<li><strong>__repr__<\/strong><\/li>\n\n\n\n<li><strong>__str__<\/strong><\/li>\n\n\n\n<li><strong>__len__<\/strong><\/li>\n\n\n\n<li><strong>and more&#8230;<\/strong><\/li>\n<\/ul>\n\n\n\n<p>In this article, we will look at two dunder methods(<code>__init__<\/code>\u00a0and\u00a0<code>__call__<\/code>) that are commonly used in Python classes. How do they differ, and when do we need to use them within the Python program?<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"Python&#039;s __init__ Method in 2 Minutes\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/mYKGYr0xaXw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-init-method\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-init-method\"><\/a>__init__&nbsp;Method<\/h1>\n\n\n\n<p>The&nbsp;<code>__init__<\/code>&nbsp;method is used to initialize the object&#8217;s attributes after the object of the class is created.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Language:\n    def __init__(self, lang, year):\n        self.lang = lang\n        self.year = year\n\n    def data(self):\n        print(f\"{self.lang} was released in {self.year}\")\n\nobject = Language(\"Python\", \"1991\")\nobject.data()<\/pre><\/div>\n\n\n\n<p>The&nbsp;<code>__init__<\/code>&nbsp;for the class&nbsp;<code>Language<\/code>&nbsp;is created in the preceding code, and it takes the parameters&nbsp;<code>lang<\/code>&nbsp;and&nbsp;<code>year<\/code>.<\/p>\n\n\n\n<p>Then we created the instance of the class&nbsp;<code>Language<\/code>, passed it the necessary arguments, and called the method&nbsp;<code>data<\/code>&nbsp;on the instance&nbsp;<code>object<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Python was released in 1991<\/pre><\/div>\n\n\n\n<p>The arguments&nbsp;<code>\"Python\"<\/code>&nbsp;and&nbsp;<code>\"1991\"<\/code>&nbsp;passed to the class are actually stored in the parameters&nbsp;<code>lang<\/code>&nbsp;and&nbsp;<code>year<\/code>&nbsp;passed to the&nbsp;<code>__init__<\/code>&nbsp;method, which initializes the instance variables (<code>self.lang<\/code>&nbsp;and&nbsp;<code>self.year<\/code>) with these values.<\/p>\n\n\n\n<p>Every time we create an object, the&nbsp;<code>__init__<\/code>&nbsp;method is automatically invoked. We&#8217;ll get different results if we create another object and pass different values.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">object1 = Language(\"JavaScript\", \"1995\")\nobject1.data()\n\n----------\nJavaScript was released in 1995<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1500\" height=\"700\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/init-viz.png\" alt=\"init visualization\" class=\"wp-image-1008\" srcset=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/init-viz.png 1500w, https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/init-viz-300x140.png 300w, https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/init-viz-1024x478.png 1024w, https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/init-viz-768x358.png 768w\" sizes=\"auto, (max-width: 1500px) 100vw, 1500px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-syntax\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-syntax\"><\/a>Syntax<\/h2>\n\n\n\n<p>Thus, we can conclude that the syntax of the&nbsp;<code>__init__<\/code>&nbsp;method can be written as the following.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class SomeClass:\n    def __init__(self, arg1, arg2, ...)\n        # constructor body<\/pre><\/div>\n\n\n\n<p>Here,<\/p>\n\n\n\n<p><code>self<\/code>&nbsp;&#8211; is an instance of the class. Mandatory.<\/p>\n\n\n\n<p><code>arg1<\/code>&nbsp;and&nbsp;<code>arg2<\/code>&nbsp;&#8211; are the parameters. We can pass as many parameters as we want or the field can also be left empty.<\/p>\n\n\n\n<p><strong>What if we pass more than the number of parameters that a class takes?<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Language:\n    def __init__(self, lang):\n        self.lang = lang\n\nobject1 = Language(\"JavaScript\", \"1995\")<\/pre><\/div>\n\n\n\n<p>The above code will throw an error and prompts the following message.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Traceback (most recent call last):\n  ...\n    object1 = Language(\"JavaScript\", \"1995\")\nTypeError: __init__() takes 2 positional arguments but 3 were given<\/pre><\/div>\n\n\n\n<p>The message states that two arguments were allowed, but three were passed. But we passed two arguments, not three then why did this happen?<\/p>\n\n\n\n<p>This occurred because&nbsp;<code>__init__<\/code>&nbsp;only accepts&nbsp;<code>self<\/code>&nbsp;and&nbsp;<code>lang<\/code>. When we instantiated the class with arguments, the keyword&nbsp;<code>self<\/code>, which represents the object&#8217;s instance, was passed along with the arguments automatically.<\/p>\n\n\n\n<p>So, when we passed the arguments&nbsp;<code>\"JavaScript\"<\/code>&nbsp;and&nbsp;<code>\"1995\"<\/code>, the&nbsp;<code>self<\/code>&nbsp;was automatically passed, making three arguments passed to the class&nbsp;<code>Language<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-init-with-and-without-parameters\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-init-with-and-without-parameters\"><\/a>__init__&nbsp;with and without parameters<\/h2>\n\n\n\n<p>Python constructor(<code>__init__<\/code>) can be created with or without passing any parameters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-default-init-constructor\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-default-init-constructor\"><\/a>Default&nbsp;__init__&nbsp;constructor<\/h3>\n\n\n\n<p><strong>A constructor created without parameters other than<\/strong>&nbsp;<code>self<\/code><strong> <\/strong><strong>(a reference to the instance being constructed) is called the default constructor.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Language:\n    def __init__(self):\n        self.lang = \"C++\"\n        self.year = 1985\n\nobject1 = Language()\nprint(object1.lang)\nprint(object1.year)<\/pre><\/div>\n\n\n\n<p>We created&nbsp;<code>self.lang<\/code>&nbsp;and&nbsp;<code>self.year<\/code>&nbsp;and assigned the default values&nbsp;<code>\"C++\"<\/code>&nbsp;and&nbsp;<code>\"1985\"<\/code>&nbsp;respectively. We accessed the&nbsp;<code>lang<\/code>&nbsp;and&nbsp;<code>year<\/code>&nbsp;by using the instance of the class&nbsp;<code>object1<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">C++\n1985<\/pre><\/div>\n\n\n\n<p>We can also override the attribute&#8217;s default value by assigning a new value before accessing the attribute from the class.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Language:\n    def __init__(self):\n        self.lang = \"C++\"\n        self.year = 1985\n\nobject1 = Language()\n# Assigned new value to the lang\nobject1.lang = \"Python\"\nprint(object1.lang)\nprint(object1.year)\n\n----------\nPython\n1985<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-init-with-parameters\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-init-with-parameters\"><\/a>__init__&nbsp;with parameters<\/h3>\n\n\n\n<p>We&#8217;ve already seen some examples where we used parameters to create the constructor. Pass the parameters to the constructor, as shown in the following example. Then we created an object or instance of the&nbsp;<code>Vehicle<\/code>&nbsp;class and passed the arguments to it. The output was then obtained by calling the&nbsp;<code>vehicle<\/code>&nbsp;function.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Vehicle:\n    def __init__(self, name, model):\n        self.name = name\n        self.model = model\n\n    def vehicle(self):\n        print(f\"Brand: {self.name} and Model: {self.model}\")\n\nbmw_car = Vehicle(\"BMW\", \"X5\")\naudi_car = Vehicle(\"Audi\", \"A4\")\n\nbmw_car.vehicle()\naudi_car.vehicle()\n\n----------\nBrand: BMW and Model: X5\nBrand: Audi and Model: A4<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-call-method\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-call-method\"><\/a>__call__&nbsp;method<\/h1>\n\n\n\n<p>When we invoke a function, we simply use the function name with parenthesis, such as&nbsp;<code>hello()<\/code>, to notify the interpreter that a function is being called. Well, we can say that it is a shorthand for&nbsp;<code>hello.__call__()<\/code>.<\/p>\n\n\n\n<p>When we invoke a function in Python, the interpreter executes the&nbsp;<code>__call__<\/code>&nbsp;method in the background.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">def func(a, b):\n    print(a + b)\n\nfunc(32, 8)\nfunc.__call__(8, 9)\n\n----------\n40\n17<\/pre><\/div>\n\n\n\n<p>In the above code, first, we called the function&nbsp;<code>func<\/code>&nbsp;simply as we usually do and then by using the&nbsp;<code>__call__<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-call-inside-python-classes\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-call-inside-python-classes\"><\/a>__call__&nbsp;inside Python classes<\/h2>\n\n\n\n<p>The concept behind using&nbsp;<code>__call__<\/code>&nbsp;is to call the instances of the classes as if they were a function.&nbsp;<strong>Instances of classes can be made callable by defining a<\/strong>&nbsp;<code>__call__<\/code>&nbsp;<strong>method in their class.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Demo:\n    def __init__(self):\n        print(\"Hello from constructor.\")\n\n    def __call__(self):\n        print(\"Hello from call.\")\n\nexample = Demo()\nexample()<\/pre><\/div>\n\n\n\n<p>In this case, we called the class object&nbsp;<code>example<\/code>&nbsp;as if it were a function.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Hello from constructor.\nHello from call.<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-syntax-1\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-syntax-1\"><\/a>Syntax<\/h2>\n\n\n\n<p>The syntax of the&nbsp;<code>__call__<\/code>&nbsp;method is<\/p>\n\n\n\n<p><code>object.__call__(self, *args, **kwargs)<\/code><\/p>\n\n\n\n<p>Here,<\/p>\n\n\n\n<p><code>self<\/code>&nbsp;&#8211; reference of the object.<\/p>\n\n\n\n<p><code>args<\/code>&nbsp;and&nbsp;<code>kwargs<\/code>&nbsp;&#8211; arguments and keyword arguments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-call-with-parameters\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-call-with-parameters\"><\/a>__call__&nbsp;with parameters<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Student:\n    def __init__(self, id, name):\n        self.id = id\n        self.name = name\n\n    def __call__(self, school):\n        print(f\"The id of {self.name} is {self.id}.\")\n        print(f\"The school name is {school}.\")\n\ndetail = Student(45, \"Sachin\")\ndetail(\"GSS\")<\/pre><\/div>\n\n\n\n<p>We passed the parameter&nbsp;<code>school<\/code>&nbsp;to the&nbsp;<code>__call__<\/code>&nbsp;method just like we do when we create the constructor. This will allow us to pass the argument within the object of the class as we did in the above code.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">The id of Sachin is 45.\nThe school name is GSS.<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-call-with-decorators\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-call-with-decorators\"><\/a>__call__&nbsp;with decorators<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">class Demo:\n    def __init__(self, action):\n        self.action = action\n        print(\"Hello from constructor.\")\n\n    def __call__(self):\n        self.action()\n        print(\"Hello from call.\")\n\n@Demo\ndef decor():\n    print(\"Called using decorator.\")\n\ndecor()<\/pre><\/div>\n\n\n\n<p>We first generated the decorator(<code>@Demo<\/code>) for the class&nbsp;<code>Demo<\/code>, followed by the function&nbsp;<code>decor<\/code>. Then we invoked the&nbsp;<code>decor<\/code>&nbsp;function and got the result shown below.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Hello from constructor.\nCalled using decorator.\nHello from call.<\/pre><\/div>\n\n\n\n<p>The decorator altered the behaviour of our class&nbsp;<code>Demo<\/code>, and we accessed the class&#8217;s attributes simply by invoking the&nbsp;<code>decor<\/code>&nbsp;function.<\/p>\n\n\n\n<p>If we examine more closely, the function&nbsp;<code>decor<\/code>&nbsp;was supplied as an argument to the class&nbsp;<code>Demo<\/code>, the&nbsp;<strong>decor&#8217;s<\/strong>&nbsp;return value was saved within the&nbsp;<code>action<\/code>&nbsp;variable, and the class was called and produced the output.<\/p>\n\n\n\n<p><strong>The decorator part in the above code is equivalent to the following.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">def decor():\n    print(\"Called using decorator.\")\n\ndecor = Demo(decor)<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-conclusion\"><a href=\"https:\/\/geekpython.in\/init-and-call-method#heading-conclusion\"><\/a>Conclusion<\/h1>\n\n\n\n<p>The&nbsp;<code>__init__<\/code>&nbsp;method is also called the constructor method which is used to initialize the objects of the specific class whereas the&nbsp;<code>__call__<\/code>&nbsp;method allows us to call the object of the class like a function.<\/p>\n\n\n\n<p>The&nbsp;<code>__init__<\/code>&nbsp;method created without passing parameters is called the default&nbsp;<code>__init__<\/code>&nbsp;constructor.<\/p>\n\n\n\n<p>When we call a function using&nbsp;<code>()<\/code>, in actuality, the&nbsp;<code>__call__<\/code>&nbsp;method is implemented in the function.<\/p>\n\n\n\n<p>We&#8217;ve coded many examples to get a better understanding of both methods.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83c\udfc6<strong>Other articles you might be interested in if you liked this one<\/strong><\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/class-inheritance-in-python\" rel=\"noreferrer noopener\">Introduction to the different types of class inheritance in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/using-transfer-learning-for-deep-learning-model\" rel=\"noreferrer noopener\">Build a deep learning model using the transfer learning technique<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/data-augmentation-in-deep-learning\" rel=\"noreferrer noopener\">Tackle the shortage of data by using the data augmentation technique<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/render-images-from-flask\" rel=\"noreferrer noopener\">Upload and display images on the frontend using Flask in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/merging-tailwindcss-into-flask-apps\" rel=\"noreferrer noopener\">Integrate TailwindCSS into the Flask app<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/python-virtual-environments-venv\" rel=\"noreferrer noopener\">Avoid conflicts between dependencies by using virtual environments<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>That&#8217;s all for now<\/strong><\/p>\n\n\n\n<p><strong>Keep Coding\u270c\u270c<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may have encountered the methods in Python that are prefixed and suffixed with&nbsp;double underscores, those methods are called&nbsp;&#8220;Dunder Methods&#8221;. These methods are also called&nbsp;&#8220;magic methods&#8221;. Dunder methods&nbsp;are used to overload specific methods in order to make their behavior unique to that class. Python has a rich collection of built-in dunder methods and a few [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1007,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[2,24],"tags":[12,31],"class_list":["post-1005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-object-oriented","tag-python","tag-python3","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/comments?post=1005"}],"version-history":[{"count":5,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1005\/revisions"}],"predecessor-version":[{"id":1576,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1005\/revisions\/1576"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/1007"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=1005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=1005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=1005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}