{"id":86410,"date":"2021-05-05T11:30:18","date_gmt":"2021-05-05T15:30:18","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=86410"},"modified":"2022-11-21T09:47:26","modified_gmt":"2022-11-21T14:47:26","slug":"object-oriented-programming-oop-in-python-part-v","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/","title":{"rendered":"Object Oriented Programming (OOP) in Python \u2013 Part V"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Review&nbsp;<a href=\"\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-i\/\">Part I<\/a>,&nbsp;&nbsp;<a href=\"\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-ii\/\">Part II<\/a><\/em>&nbsp;,<em>&nbsp;<a href=\"\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-iii\/\">Part III<\/a> and <a href=\"\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-iv\/\">Part IV<\/a><\/em> <em>for an overview of Python&nbsp;classes and their objects.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-are-the-attributes-and-methods\"><strong>What are the attributes and methods?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I am pretty sure that you know what I mean by attributes and methods. We have seen examples of attributes and methods multiple times by now. Keeping this in mind, I will directly jump to its implementation in Python.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The below example shows how to define a class with some default attributes and methods:<\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\"> \nclass Car:<br><br>\n\n    colour = &#8216;White&#8217;<br>\n    seating_capacity = 5<br><br>\n\n    def drive_forward(self, meters):<br>\n        print(f&#8217;Driving {meters} meters ahead&#8217;)<br><br>\n\n    def lower_windows(self):<br>\n        print(&#8216;Lowering windows on all doors&#8217;)<br>\n        print(&#8216;Windows lowered&#8217;)\n\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The updated class definition now resembles a real-world car to some extent. This time it has got two attributes,&nbsp;<code>colour<\/code>&nbsp;and&nbsp;<code>seating_capacity<\/code>, and two methods,&nbsp;<code>drive_forward()<\/code>&nbsp;and&nbsp;<code>lower_windows()<\/code>&nbsp;built-in it. That means, when we create an object of such a class, it will have these attributes and methods by default.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Of course, we can update these attribute values (neither all cars are White in colour nor all cars have a seating capacity of five). A new car object created below using the new class defined demonstrates this point.<\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\"> \n\ncar_3 = Car()<br><br>\n\n# Printing the default values<br>\nprint(&#8216;The colour of Car 3 is:&#8217;, car_3.colour)<br>\nprint(&#8216;The seating capacity of Car 3 is:&#8217;, car_3.seating_capacity)\n\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The output is shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>The colour of Car 3 is: White\nThe seating capacity of Car 3 is: 5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see in the above example, we can access a given object&#8217;s attributes (and methods) using the dot operator. To modify default behaviour, we simply assign new values to attributes as shown below.<\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\"> \ncar_3.colour = &#8216;Magma Red&#8217;<br>\ncar_3.seating_capacity = <br>\n\n# Printing the modified values<br>\nprint(&#8216;The colour of Car 3 is:&#8217;, car_3.colour)<br>\nprint(&#8216;The seating capacity of Car 3 is:&#8217;, car_3.seating_capacity)\n\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It will yield the following result:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>The colour of Car 3 is: Magma Red\nThe seating capacity of Car 3 is: 2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the real-world analogy, this operation is similar to modifying a car in real. The methods within a class define functionalities of a car. This means we can call methods using the objects only. Because if we don&#8217;t have a car, there won&#8217;t be a question of accessing its functionality.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We call methods on&nbsp;<code>car_3<\/code>, as shown below:<\/p>\n\n\n\n<p style=\"background-color:#fcfcdb;font-size:11px\" class=\"has-background\"> \n# Commanding the car to drive 500 meters<br>\ncar_3.drive_forward(500)<br><br>\n\n# Commanding the car to lower windows<br>\ncar_3.lower_windows()\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Calling methods, as shown above, would output the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Driving 500 meters ahead\nLowering windows on all doors\nWindows lowered<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">One thing to note here is, we cannot alter the behaviour of the methods defined within a class using their objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this fashion, we can create as many objects of the class&nbsp;<code>Car<\/code>&nbsp;as we need. But wait, let&#8217;s consider that we create twenty objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, the&nbsp;<code>colour<\/code>&nbsp;attribute of all those objects would have the same value,&nbsp;<code>White<\/code>. And we all know that in the real world, we have cars with all imaginable colours.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To replicate such a scenario, we might want to change the colour of those twenty objects. In the current implementation, we would need to change the colour attributes of all those objects. This approach does not seem to be efficient.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instead,&nbsp;<em>what if we can have a facility to change each object&#8217;s colour the moment we create them<\/em>?&nbsp;<code>__init__<\/code>&nbsp;method to our rescue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Stay tuned for the next installment in which Jay will discuss the init method.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Visit QuantInsti to read more about this research:&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/object-oriented-programming-python\/\">https:\/\/blog.quantinsti.com\/object-oriented-programming-python\/<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.<\/p>\n","protected":false},"author":328,"featured_media":19357,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[339,343,349,338,350,341,344],"tags":[4873,9305,865,9306,1224,9356,595,6810,9418],"contributors-categories":[13654],"class_list":["post-86410","post","type-post","status-publish","format-standard","has-post-thumbnail","category-data-science","category-programing-languages","category-python-development","category-ibkr-quant-news","category-quant-asia-pacific","category-quant-development","category-quant-regions","tag-backtesting","tag-functional-programming","tag-github","tag-object-oriented-programming","tag-pandas","tag-procedural-programming","tag-python","tag-sklearn","tag-zipline","contributors-categories-quantinsti"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v28.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Object Oriented Programming (OOP) in Python \u2013 Part V<\/title>\n<meta name=\"description\" content=\"Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.\" \/>\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.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/86410\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Object Oriented Programming (OOP) in Python \u2013 Part V | IBKR Quant Blog\" \/>\n<meta property=\"og:description\" content=\"Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-05T15:30:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-21T14:47:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1150\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jay Parmar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jay Parmar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Jay Parmar\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e77e7794714e57aa7d6e8ec9be051768\"\n\t            },\n\t            \"headline\": \"Object Oriented Programming (OOP) in Python \u2013 Part V\",\n\t            \"datePublished\": \"2021-05-05T15:30:18+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:47:26+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/\"\n\t            },\n\t            \"wordCount\": 576,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/09\\\/python-quant-blog.jpg\",\n\t            \"keywords\": [\n\t                \"backtesting\",\n\t                \"Functional Programming\",\n\t                \"GitHub\",\n\t                \"Object Oriented Programming\",\n\t                \"Pandas\",\n\t                \"Procedural Programming\",\n\t                \"Python\",\n\t                \"sklearn\",\n\t                \"zipline\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Asia Pacific\",\n\t                \"Quant Development\",\n\t                \"Quant Regions\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/\",\n\t            \"name\": \"Object Oriented Programming (OOP) in Python \u2013 Part V | IBKR Quant Blog\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/09\\\/python-quant-blog.jpg\",\n\t            \"datePublished\": \"2021-05-05T15:30:18+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:47:26+00:00\",\n\t            \"description\": \"Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/object-oriented-programming-oop-in-python-part-v\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/09\\\/python-quant-blog.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/09\\\/python-quant-blog.jpg\",\n\t            \"width\": 1150,\n\t            \"height\": 700,\n\t            \"caption\": \"Python Programming\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e77e7794714e57aa7d6e8ec9be051768\",\n\t            \"name\": \"Jay Parmar\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/jayparmar\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Object Oriented Programming (OOP) in Python \u2013 Part V","description":"Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.","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:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/86410\/","og_locale":"en_US","og_type":"article","og_title":"Object Oriented Programming (OOP) in Python \u2013 Part V | IBKR Quant Blog","og_description":"Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/","og_site_name":"IBKR Campus US","article_published_time":"2021-05-05T15:30:18+00:00","article_modified_time":"2022-11-21T14:47:26+00:00","og_image":[{"width":1150,"height":700,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg","type":"image\/jpeg"}],"author":"Jay Parmar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jay Parmar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/"},"author":{"name":"Jay Parmar","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e77e7794714e57aa7d6e8ec9be051768"},"headline":"Object Oriented Programming (OOP) in Python \u2013 Part V","datePublished":"2021-05-05T15:30:18+00:00","dateModified":"2022-11-21T14:47:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/"},"wordCount":576,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg","keywords":["backtesting","Functional Programming","GitHub","Object Oriented Programming","Pandas","Procedural Programming","Python","sklearn","zipline"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Asia Pacific","Quant Development","Quant Regions"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/","name":"Object Oriented Programming (OOP) in Python \u2013 Part V | IBKR Quant Blog","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg","datePublished":"2021-05-05T15:30:18+00:00","dateModified":"2022-11-21T14:47:26+00:00","description":"Jay Parmar demonstrates how to define a class with some default attributes and methods using Python.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/object-oriented-programming-oop-in-python-part-v\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg","width":1150,"height":700,"caption":"Python Programming"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e77e7794714e57aa7d6e8ec9be051768","name":"Jay Parmar","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/jayparmar\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/09\/python-quant-blog.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/86410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/328"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=86410"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/86410\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/19357"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=86410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=86410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=86410"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=86410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}