{"id":1043,"date":"2023-03-27T21:16:00","date_gmt":"2023-03-27T15:46:00","guid":{"rendered":"https:\/\/geekpython.in\/?p=1043"},"modified":"2023-10-29T10:10:47","modified_gmt":"2023-10-29T04:40:47","slug":"abc-in-python","status":"publish","type":"post","link":"https:\/\/geekpython.in\/abc-in-python","title":{"rendered":"Python&#8217;s ABC: Understanding the Basics of Abstract Base Classes"},"content":{"rendered":"\n<p>What is the ABC of Python? It stands for the&nbsp;<strong>abstract base class<\/strong>&nbsp;and is a concept in Python classes based on abstraction.&nbsp;<strong>Abstraction<\/strong>&nbsp;is an integral part of object-oriented programming.<\/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 ABC (Abstract Base Class) in 2 Minutes\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/G-w5PvPQl5Q?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<p><strong>Abstraction<\/strong>&nbsp;is what we call&nbsp;<strong>hiding the internal process of the program<\/strong>&nbsp;from the users. Take the example of the computer mouse where we click the left or right button and something respective of it happens or scroll the mouse wheel and a specific task happens. We are unaware of the internal functionality but we do know that clicking this button will do our job.<\/p>\n\n\n\n<p>In abstraction, users are unaware of the internal functionality but are familiar with the purpose of the method. If we take an example of a\u00a0<code>datetime<\/code>\u00a0module, we do know that running the\u00a0<code>datetime.now()<\/code>\u00a0function will return the current date and time but are unaware of how this happens.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-abc-in-python\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-abc-in-python\"><\/a>ABC in Python<\/h2>\n\n\n\n<p>Python is not a fully object-oriented programming language but it supports the features like abstract classes and abstraction. We cannot create abstract classes directly in Python, so Python provides a module called&nbsp;<code>abc<\/code>&nbsp;that provides the infrastructure for defining the base of&nbsp;<strong>Abstract Base Classes<\/strong>(ABC).<\/p>\n\n\n\n<p>What are abstract base classes? They provide a blueprint for concrete classes. They are just defined but not implemented rather they require subclasses for implementation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-defining-abc\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-defining-abc\"><\/a>Defining ABC<\/h2>\n\n\n\n<p>Let&#8217;s understand with an example how we can define an abstract class with an abstract method inside it.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractmethod\n\nclass Friend(ABC):\n\n    @abstractmethod\n    def role(self):\n        pass<\/pre><\/div>\n\n\n\n<p>The class&nbsp;<code>Friend<\/code>&nbsp;derived from the&nbsp;<code>ABC<\/code>&nbsp;class from the&nbsp;<code>abc<\/code>&nbsp;module that makes it an abstract class and then within the class, a decorator&nbsp;<code>@abstractmethod<\/code>&nbsp;is defined to indicate that the function&nbsp;<code>role<\/code>&nbsp;is an abstract method.<\/p>\n\n\n\n<p><code>abc<\/code>&nbsp;module has another class&nbsp;<code>ABCMeta<\/code>&nbsp;which is used to create abstract classes.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABCMeta, abstractmethod\n\nclass Friend(metaclass=ABCMeta):\n\n    @abstractmethod\n    def role(self):\n        pass<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-abc-in-action\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-abc-in-action\"><\/a>ABC in action<\/h2>\n\n\n\n<p>Now we&#8217;ll see how to make an abstract class and abstract method and then implement it inside the concrete classes through inheritance.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractmethod\n\n\n# Defining abstract class\nclass Friends(ABC):\n    \"\"\"abstract method decorator to indicate that the\n    method right below is an abstract method.\"\"\"\n\n    @abstractmethod\n    def role(self):\n        pass\n\n\n# Concrete derived class inheriting from abstract class\nclass Sachin(Friends):\n    # Implementing abstract method\n    def role(self):\n        print('Python Developer')\n\n\n# Concrete derived class inheriting from abstract class\nclass Rishu(Friends):\n    # Implementing abstract method\n    def role(self):\n        print('C++ Developer')\n\n\n# Concrete derived class inheriting from abstract class\nclass Yashwant(Friends):\n    # Implementing abstract method\n    def role(self):\n        print('C++ Developer')\n\n\n# Instantiating concrete derived class\nroles = Sachin()\nroles.role()\n# Instantiating concrete derived class\nroles = Rishu()\nroles.role()\n# Instantiating concrete derived class\nroles = Yashwant()\nroles.role()<\/pre><\/div>\n\n\n\n<p>In the above code, we created an abstract class called&nbsp;<code>Friends<\/code>&nbsp;and defined the abstract method&nbsp;<code>role<\/code>&nbsp;within the class using the&nbsp;<code>@abstractmethod<\/code>&nbsp;decorator.<\/p>\n\n\n\n<p>Then we created three concrete derived classes,&nbsp;<code>Sachin<\/code>,&nbsp;<code>Rishu<\/code>, and&nbsp;<code>Yashwant<\/code>, that inherits from the class&nbsp;<code>Friends<\/code>&nbsp;and implemented the abstract method&nbsp;<code>role<\/code>&nbsp;within them.<\/p>\n\n\n\n<p>Then we instantiated the derived classes and called the&nbsp;<code>role<\/code>&nbsp;using the instance of the classes to display the result.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Python Developer\nC++ Developer\nC++ Developer<\/pre><\/div>\n\n\n\n<p>As we discussed earlier,&nbsp;<strong>abstract classes provide a blueprint for implementing methods into concrete subclasses<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractmethod\n\nclass Details(ABC):\n    @abstractmethod\n    def getname(self):\n        return self.name\n\n    @abstractmethod\n    def getrole(self):\n        return self.role\n\n    @abstractmethod\n    def gethobby(self):\n        return self.hobby\n\n\nclass Sachin(Details):\n    def __init__(self, name=\"Sachin\"):\n        self.name = name\n        self.role = \"Python Dev\"\n        self.hobby = \"Fuseball spielen\"\n\n    def getname(self):\n        return self.name\n\n    def getrole(self):\n        return self.role\n\n    def gethobby(self):\n        return self.hobby\n\n\ndetail = Sachin()\nprint(detail.getname())\nprint(detail.getrole())\nprint(detail.gethobby())<\/pre><\/div>\n\n\n\n<p>In the above code, we created a blueprint for the class&nbsp;<code>Details<\/code>. Then we created a class called&nbsp;<code>Sachin<\/code>&nbsp;that inherits from&nbsp;<code>Details<\/code>, and we implemented the methods according to the blueprint.<\/p>\n\n\n\n<p>Then we instantiated the class&nbsp;<code>Sachin<\/code>&nbsp;and then printed the values of&nbsp;<code>getname<\/code>,&nbsp;<code>getrole<\/code>&nbsp;and&nbsp;<code>gethobby<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Sachin\nPython Dev\nFuseball spielen<\/pre><\/div>\n\n\n\n<p><strong>What if we create a class that doesn&#8217;t follow the abstract class blueprint?<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractmethod\n\nclass Details(ABC):\n    @abstractmethod\n    def getname(self):\n        return self.name\n\n    @abstractmethod\n    def getrole(self):\n        return self.role\n\n    @abstractmethod\n    def gethobby(self):\n        return self.hobby\n\n\nclass Sachin(Details):\n    def __init__(self, name=\"Sachin\"):\n        self.name = name\n        self.role = \"Python Dev\"\n        self.hobby = \"Fuseball spielen\"\n\n    def getname(self):\n        return self.name\n\n    def getrole(self):\n        return self.role\n\n\ndetail = Sachin()\nprint(detail.getname())\nprint(detail.getrole())<\/pre><\/div>\n\n\n\n<p>Python will raise an error upon executing the above code because the class&nbsp;<code>Sachin<\/code>&nbsp;doesn&#8217;t follow the class&nbsp;<code>Details<\/code>&nbsp;blueprint.<\/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  ....\nTypeError: Can't instantiate abstract class Sachin with abstract method gethobby<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-use-of-abc\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-use-of-abc\"><\/a>Use of ABC<\/h3>\n\n\n\n<p>As we saw in the above example that if a derived class doesn&#8217;t follow the blueprint of the abstract class, then the error will be raised.<\/p>\n\n\n\n<p>That&#8217;s where ABC(Abstract Base Class) plays an important role in making sure that the subclasses must follow that blueprint. Thus we can say that the subclasses inherited from the abstract class must follow the same structure and implements the abstract methods.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-concrete-methods-inside-abc\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-concrete-methods-inside-abc\"><\/a>Concrete methods inside ABC<\/h2>\n\n\n\n<p>We can also define concrete methods within the abstract classes. The concrete method is the normal method that has a complete definition.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractmethod\n\n# Abstract class\nclass Demo(ABC):\n    # Defining a concrete method\n    def concrete_method(self):\n        print(\"Calling concrete method\")\n\n    @abstractmethod\n    def data(self):\n        pass\n\n# Derived class\nclass Test(Demo):\n\n    def data(self):\n        pass\n\n# Instantiating the class\ndata = Test()\n# Calling the concrete method\ndata.concrete_method()<\/pre><\/div>\n\n\n\n<p>In the above code,&nbsp;<code>concrete_method<\/code>&nbsp;is a concrete method defined within the abstract class and the method was invoked using the instance of the class&nbsp;<code>Test<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Calling concrete method<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-abstract-class-instantiation\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-abstract-class-instantiation\"><\/a>Abstract class instantiation<\/h2>\n\n\n\n<p>An abstract class can only be defined but cannot be instantiated because of the fact that they are not a concrete class. Python doesn&#8217;t allow creating objects for abstract classes because there is no actual implementation to invoke rather they require subclasses for implementation.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractmethod\n\nclass Details(ABC):\n    @abstractmethod\n    def getname(self):\n        return self.name\n\n    @abstractmethod\n    def getrole(self):\n        return self.role\n\nclass Sachin(Details):\n    def __init__(self, name=\"Sachin\"):\n        self.name = name\n        self.role = \"Python Dev\"\n\n    def getname(self):\n        return self.name\n\n    def getrole(self):\n        return self.role\n\n# Instantiating the abstract class\nabstract_class = Details()<\/pre><\/div>\n\n\n\n<p><strong>Output<\/strong><\/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  ....\nTypeError: Can't instantiate abstract class Details with abstract methods getname, getrole<\/pre><\/div>\n\n\n\n<p>We got the error stating that we cannot instantiate the abstract class&nbsp;<code>Details<\/code>&nbsp;with abstract methods called&nbsp;<code>getname<\/code>&nbsp;and&nbsp;<code>getrole<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-abstract-property\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-abstract-property\"><\/a>Abstract property<\/h2>\n\n\n\n<p>Just as the&nbsp;<code>abc<\/code>&nbsp;module allows us to define abstract methods using the&nbsp;<code>@abstractmethod<\/code>&nbsp;<strong>decorator<\/strong>, it also allows us to define&nbsp;<strong>abstract properties<\/strong>&nbsp;using the&nbsp;<code>@abstractproperty<\/code>&nbsp;<strong>decorator<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractproperty\n\n# Abstract class\nclass Hero(ABC):\n\n    @abstractproperty\n    def hero_name(self):\n        return self.hname\n\n    @abstractproperty\n    def reel_name(self):\n        return self.rname\n\n# Derived class\nclass RDJ(Hero):\n\n    def __init__(self):\n        self.hname = \"IronMan\"\n        self.rname = \"Tony Stark\"\n\n    @property\n    def hero_name(self):\n        return self.hname\n    @property\n    def reel_name(self):\n        return self.rname\n\ndata = RDJ()\nprint(f'The hero name is: {data.hero_name}')\nprint(f'The reel name is: {data.reel_name}')<\/pre><\/div>\n\n\n\n<p>We created an abstract class&nbsp;<code>Hero<\/code>&nbsp;and defined two abstract properties called&nbsp;<code>hero_name<\/code>&nbsp;and&nbsp;<code>reel_name<\/code>&nbsp;using&nbsp;<code>@abstractproperty<\/code>. Then, within the derived class&nbsp;<code>RDJ<\/code>, we used the&nbsp;<code>@property<\/code>&nbsp;decorator to implement them that will make them a&nbsp;<strong>getter method<\/strong>.<\/p>\n\n\n\n<p>Then we instantiated the class&nbsp;<code>RDJ<\/code>&nbsp;and used the class instance to access the values of&nbsp;<code>hero_name<\/code>&nbsp;and&nbsp;<code>reel_name<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">The hero name is: IronMan\nThe reel name is: Tony Stark<\/pre><\/div>\n\n\n\n<p>If we had not placed the&nbsp;<code>@property<\/code>&nbsp;decorator inside the class&nbsp;<code>RDJ<\/code>, we would have had to call the&nbsp;<code>hero_name<\/code>&nbsp;and&nbsp;<code>reel_name<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">from abc import ABC, abstractproperty\n\n# Abstract class\nclass Hero(ABC):\n    @abstractproperty\n    def hero_name(self):\n        return self.hname\n\n    @abstractproperty\n    def reel_name(self):\n        return self.rname\n\n# Derived class\nclass RDJ(Hero):\n\n    def __init__(self):\n        self.hname = \"IronMan\"\n        self.rname = \"Tony Stark\"\n\n    def hero_name(self):\n        return self.hname\n\n    def reel_name(self):\n        return self.rname\n\ndata = RDJ()\nprint(f'The hero name is: {data.hero_name()}')\nprint(f'The reel name is: {data.reel_name()}')\n\n----------\nThe hero name is: IronMan\nThe reel name is: Tony Stark<\/pre><\/div>\n\n\n\n<p><strong>Note:<\/strong>&nbsp;<code>abstractproperty<\/code>&nbsp;<strong>is a deprecated class, instead we can use<\/strong>&nbsp;<code>@property<\/code>&nbsp;<strong>with<\/strong>&nbsp;<code>@abstractmethod<\/code>&nbsp;<strong>to define an abstract property<\/strong>.&nbsp;<strong>Pycharm IDE gives a warning upon using the abstractproperty class<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"397\" height=\"352\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/deprecated.png\" alt=\"Deprecation warning\" class=\"wp-image-1046\" srcset=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/deprecated.png 397w, https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/deprecated-300x266.png 300w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/figure>\n\n\n\n<p>The above code will look like the following if we modify it.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># Abstract class\nclass Hero(ABC):\n    @property\n    @abstractmethod\n    def hero_name(self):\n        return self.hname\n\n    @property\n    @abstractmethod\n    def reel_name(self):\n        return self.rname<\/pre><\/div>\n\n\n\n<p>Just apply the modifications as shown in the above code within the abstract class and run the code. The code will run without any error as earlier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-conclusion\"><a href=\"https:\/\/geekpython.in\/abc-in-python#heading-conclusion\"><\/a>Conclusion<\/h2>\n\n\n\n<p>We&#8217;ve covered the fundamentals of abstract classes, abstract methods, and abstract properties in this article. Python has an&nbsp;<code>abc<\/code>&nbsp;module that provides infrastructure for defining abstract base classes.<\/p>\n\n\n\n<p>The&nbsp;<code>ABC<\/code>&nbsp;class from the&nbsp;<code>abc<\/code>&nbsp;module can be used to create an abstract class.&nbsp;<code>ABC<\/code>&nbsp;is a helper class that has&nbsp;<code>ABCMeta<\/code>&nbsp;as its metaclass, and we can also define abstract classes by passing the&nbsp;<code>metaclass<\/code>&nbsp;keyword and using&nbsp;<code>ABCMeta<\/code>. The only difference between the two classes is that&nbsp;<code>ABCMeta<\/code>&nbsp;has additional functionality.<\/p>\n\n\n\n<p>After creating the abstract class, we used the&nbsp;<code>@abstractmethod<\/code>&nbsp;and (<code>@property<\/code>&nbsp;with&nbsp;<code>@abstractmethod<\/code>) decorators to define the abstract methods and abstract properties within the class.<\/p>\n\n\n\n<p>To understand the theory, we&#8217;ve coded the examples alongside the explanation.<\/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\">What are class inheritance and different types of inheritance in Python<\/a>?<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/super-in-python\" rel=\"noreferrer noopener\">Learn the use cases of the super() function in Python classes<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/access-modifiers-in-python\" rel=\"noreferrer noopener\">How underscores modify accessing the attributes and methods in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/init-and-call-method\" rel=\"noreferrer noopener\">What are __init__ and __call__ in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/flask-app-for-image-recognition\" rel=\"noreferrer noopener\">Implement a custom deep learning model into the Flask app for image recognition<\/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\">Train a custom 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\">How to augment data using the existing data in Python<\/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>What is the ABC of Python? It stands for the&nbsp;abstract base class&nbsp;and is a concept in Python classes based on abstraction.&nbsp;Abstraction&nbsp;is an integral part of object-oriented programming. Abstraction&nbsp;is what we call&nbsp;hiding the internal process of the program&nbsp;from the users. Take the example of the computer mouse where we click the left or right button and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1045,"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":[24,2],"tags":[26,12,31],"class_list":["post-1043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-object-oriented","category-python","tag-oop","tag-python","tag-python3","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1043","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=1043"}],"version-history":[{"count":5,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1043\/revisions"}],"predecessor-version":[{"id":1575,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1043\/revisions\/1575"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/1045"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=1043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=1043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=1043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}