title
Object Oriented Programming with Python - Full Course for Beginners
description
Object Oriented Programming is an important concept in software development. In this complete tutorial, you will learn all about OOP and how to implement it using Python.
💻 Code: https://github.com/jimdevops19/PythonOOP
🔗 Tutorial referenced for a deeper explanation about __repr__: https://www.youtube.com/watch?v=FIaPZXaePhw
✏️ Course developed by Jim from JimShapedCoding. Check out his channel: https://www.youtube.com/channel/UCU8d7rcShA7MGuDyYH1aWGg
⭐️ Course Contents ⭐️
⌨️ (0:00:00) Getting Started with Classes
⌨️ (0:12:11) Constructor, __init__
⌨️ (0:50:35) Class vs Static Methods
⌨️ (1:13:22) Inheritance
⌨️ (1:30:14) Getters and Setters
⌨️ (1:51:00) OOP Principles
🎉 Thanks to our Champion and Sponsor supporters:
👾 Wong Voon jinq
👾 hexploitation
👾 Katia Moran
👾 BlckPhantom
👾 Nick Raker
👾 Otis Morgan
👾 DeezMaster
👾 AppWrite
--
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://freecodecamp.org/news
detail
{'title': 'Object Oriented Programming with Python - Full Course for Beginners', 'heatmap': [{'end': 2789.685, 'start': 2620.386, 'weight': 0.919}, {'end': 3343.697, 'start': 3100.9, 'weight': 1}, {'end': 3666.286, 'start': 3578.146, 'weight': 0.831}, {'end': 4217.806, 'start': 4056.103, 'weight': 0.847}, {'end': 5333.114, 'start': 5248.466, 'weight': 0.714}, {'end': 5572.473, 'start': 5486.648, 'weight': 0.819}], 'summary': 'A full python object-oriented programming course by jimshapecoding covers oop basics, best practices, class attributes, methods, inheritance, read-only attributes, and code organization, with real-world examples, emphasizing practical learning and software development skills enhancement.', 'chapters': [{'end': 34.368, 'segs': [{'end': 32.787, 'src': 'embed', 'start': 0.129, 'weight': 0, 'content': [{'end': 4.331, 'text': "It's important for software developers to understand object-oriented programming.", 'start': 0.129, 'duration': 4.202}, {'end': 10.734, 'text': 'In this course, Jim from JimShapeCoding will teach you all about object-oriented programming in Python.', 'start': 4.951, 'duration': 5.783}, {'end': 20.539, 'text': 'Object-oriented programming could be what is holding you back from being a great Python developer and as well as landing your first job as a software engineer.', 'start': 10.974, 'duration': 9.565}, {'end': 24.941, 'text': 'Welcome everyone to Python object-oriented programming course.', 'start': 21.159, 'duration': 3.782}, {'end': 32.787, 'text': 'Now, if you struggle to understand the concepts of object-oriented programming in the past, then you are totally fine and you are in good hands,', 'start': 25.541, 'duration': 7.246}], 'summary': "Jimshapecoding's course will help you master python object-oriented programming and advance your career.", 'duration': 32.658, 'max_score': 0.129, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs129.jpg'}], 'start': 0.129, 'title': 'Python oop basics with jim', 'summary': 'Covers the importance of understanding object-oriented programming for software developers and introduces a course by jimshapecoding focusing on teaching python object-oriented programming to help developers improve their skills and job prospects.', 'chapters': [{'end': 34.368, 'start': 0.129, 'title': 'Python oop basics with jim', 'summary': 'Covers the importance of understanding object-oriented programming for software developers, and introduces a course by jimshapecoding focusing on teaching python object-oriented programming to help developers improve their skills and job prospects.', 'duration': 34.239, 'highlights': ['JimShapeCoding provides a course on Python object-oriented programming to help developers improve their skills and job prospects.', 'Understanding object-oriented programming is crucial for software developers, as it can be the key to becoming a great Python developer and landing the first job as a software engineer.']}], 'duration': 34.239, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs129.jpg', 'highlights': ['Understanding object-oriented programming is crucial for software developers, as it can be the key to becoming a great Python developer and landing the first job as a software engineer.', 'JimShapeCoding provides a course on Python object-oriented programming to help developers improve their skills and job prospects.']}, {'end': 708.203, 'segs': [{'end': 97.027, 'src': 'embed', 'start': 34.368, 'weight': 0, 'content': [{'end': 44.976, 'text': "I'm going to make sure that this will be the last tutorial that you will ever watch about classes and the complex concepts that comes with object-oriented programming.", 'start': 34.368, 'duration': 10.608}, {'end': 52.081, 'text': 'And we are going to do this by developing a real Python application that is going to be very cool to write.', 'start': 45.516, 'duration': 6.565}, {'end': 55.984, 'text': 'And we will add to its complexity step by step.', 'start': 52.562, 'duration': 3.422}, {'end': 61.589, 'text': 'And throughout the way, we will understand everything that we need to know about object oriented programming.', 'start': 56.505, 'duration': 5.084}, {'end': 64.631, 'text': 'Now there are going to be some requirements to this course.', 'start': 62.049, 'duration': 2.582}, {'end': 71.595, 'text': 'I do expect from everybody to know at least about functions, variables, if statements, and as well as for loops.', 'start': 65.051, 'duration': 6.544}, {'end': 76.978, 'text': 'And if you know those things from other programming languages, then this is also fine.', 'start': 71.995, 'duration': 4.983}, {'end': 79.26, 'text': "So with that being said, let's get started.", 'start': 77.079, 'duration': 2.181}, {'end': 82.961, 'text': 'Now to explain why you should write object oriented programs.', 'start': 79.64, 'duration': 3.321}, {'end': 88.304, 'text': 'I will explain the concepts based on a store management system that we will start developing together.', 'start': 82.961, 'duration': 5.343}, {'end': 92.846, 'text': 'So starting to think about how to take our first steps with such a program.', 'start': 88.764, 'duration': 4.082}, {'end': 97.027, 'text': 'we could first think about tracking after the items that we have right now in our store.', 'start': 92.846, 'duration': 4.181}], 'summary': 'Developing a real python application to teach object-oriented programming with specific prerequisites, using a store management system as an example.', 'duration': 62.659, 'max_score': 34.368, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs34368.jpg'}, {'end': 325.956, 'src': 'embed', 'start': 291.943, 'weight': 3, 'content': [{'end': 296.604, 'text': 'So it is very important to understand how classes are working in Python.', 'start': 291.943, 'duration': 4.661}, {'end': 300.105, 'text': 'So I will delete this line because this was just for an example.', 'start': 296.764, 'duration': 3.341}, {'end': 305.527, 'text': 'And now I said that we are allowed to assign some attributes to instances of a class.', 'start': 300.645, 'duration': 4.882}, {'end': 308.748, 'text': "So let's go ahead and start creating attributes.", 'start': 305.927, 'duration': 2.821}, {'end': 314.95, 'text': 'And that will be achievable by using the dot sign right after the instance of a class.', 'start': 308.908, 'duration': 6.042}, {'end': 325.956, 'text': 'And here you can say that you want to give it an attribute like a name that will be equal to phone and item one dot price could be equal to 100.', 'start': 315.49, 'duration': 10.466}], 'summary': 'Learning about creating attributes in python classes.', 'duration': 34.013, 'max_score': 291.943, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs291943.jpg'}, {'end': 567.726, 'src': 'embed', 'start': 537.341, 'weight': 2, 'content': [{'end': 546.951, 'text': 'Now the reason that this happens, Python passes the object itself as a first argument, when you go ahead and call those methods.', 'start': 537.341, 'duration': 9.61}, {'end': 557.699, 'text': 'Now, if I was to go here and say item one dot calculate total price, then the action that we are doing now is calling this method.', 'start': 547.451, 'duration': 10.248}, {'end': 567.726, 'text': 'But when you go ahead and call a method from an instance, then Python passes the the object itself as the first argument every time.', 'start': 558.059, 'duration': 9.667}], 'summary': 'Python passes the object itself as the first argument when calling methods.', 'duration': 30.385, 'max_score': 537.341, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs537341.jpg'}], 'start': 34.368, 'title': 'Python object-oriented programming', 'summary': 'Introduces a python tutorial on object-oriented programming, emphasizing the development of a real python application to understand complex concepts. it covers the creation of classes, instances, attributes, and methods, with a practical example of calculating the total price of items.', 'chapters': [{'end': 97.027, 'start': 34.368, 'title': 'Object-oriented programming tutorial', 'summary': 'Introduces a python tutorial on object-oriented programming, emphasizing the development of a real python application to understand complex concepts, with prerequisites including knowledge of functions, variables, if statements, and for loops, and highlights the relevance of writing object-oriented programs through the example of a store management system.', 'duration': 62.659, 'highlights': ['The chapter emphasizes the importance of developing a real Python application to understand complex object-oriented programming concepts.', 'Prerequisites for the course include knowledge of functions, variables, if statements, and for loops.', 'The chapter highlights the relevance of writing object-oriented programs through the example of a store management system.']}, {'end': 708.203, 'start': 97.207, 'title': 'Python object oriented programming', 'summary': 'Explains the concept of object-oriented programming using python, covering the creation of classes, instances, attributes, and methods, with a practical example of calculating the total price of items.', 'duration': 610.996, 'highlights': ['The chapter explains the concept of object-oriented programming using Python. Covers the basics of object-oriented programming and its implementation in Python.', 'Creating classes, instances, attributes, and methods in Python. Illustrates the process of creating classes, instances, and defining attributes and methods within the class structure.', 'Practical example of calculating the total price of items using methods in Python. Demonstrates a practical example of creating a method to calculate the total price of items based on their attributes in Python.']}], 'duration': 673.835, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs34368.jpg', 'highlights': ['The chapter emphasizes the importance of developing a real Python application to understand complex object-oriented programming concepts.', 'The chapter highlights the relevance of writing object-oriented programs through the example of a store management system.', 'Practical example of calculating the total price of items using methods in Python. Demonstrates a practical example of creating a method to calculate the total price of items based on their attributes in Python.', 'Creating classes, instances, attributes, and methods in Python. Illustrates the process of creating classes, instances, and defining attributes and methods within the class structure.', 'The chapter explains the concept of object-oriented programming using Python. Covers the basics of object-oriented programming and its implementation in Python.', 'Prerequisites for the course include knowledge of functions, variables, if statements, and for loops.']}, {'end': 1838.06, 'segs': [{'end': 891.828, 'src': 'embed', 'start': 865.492, 'weight': 1, 'content': [{'end': 873.443, 'text': 'So when you go ahead and create an instance of a class, then Python executes this double underscore init function automatically.', 'start': 865.492, 'duration': 7.951}, {'end': 880.125, 'text': 'So what that means, it means that now that we have declared our class, Python is going to run through this line.', 'start': 873.823, 'duration': 6.302}, {'end': 886.107, 'text': 'And then, since an instance has been created and we have double underscore init method designed,', 'start': 880.505, 'duration': 5.602}, {'end': 891.828, 'text': 'then it is going to call the actions that are inside this double underscore init, double underscore method.', 'start': 886.107, 'duration': 5.721}], 'summary': 'Python automatically executes double underscore init function when creating a class instance.', 'duration': 26.336, 'max_score': 865.492, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs865492.jpg'}, {'end': 1276.061, 'src': 'embed', 'start': 1248.103, 'weight': 3, 'content': [{'end': 1254.267, 'text': "this doesn't mean that we cannot differentiate between mandatory parameters to non mandatory parameters.", 'start': 1248.103, 'duration': 6.164}, {'end': 1260.192, 'text': "So say that you currently don't know how much you have from a specific item,", 'start': 1254.688, 'duration': 5.504}, {'end': 1265.536, 'text': 'then you can go ahead and by default receive this quantity parameter as zero.', 'start': 1260.192, 'duration': 5.344}, {'end': 1270.638, 'text': "because it is realistic situation that you currently don't know how much phones you have on your store.", 'start': 1265.936, 'duration': 4.702}, {'end': 1276.061, 'text': 'So we can directly go ahead and use a default value for that, for example, zero.', 'start': 1271.018, 'duration': 5.043}], 'summary': 'Differentiate mandatory and non-mandatory parameters, defaulting to zero for unknown quantities.', 'duration': 27.958, 'max_score': 1248.103, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs1248103.jpg'}, {'end': 1320.26, 'src': 'embed', 'start': 1295.009, 'weight': 2, 'content': [{'end': 1304.073, 'text': "And one more quite important point that I'd like to talk about now is the fact that you can assign attributes to specific instances individually.", 'start': 1295.009, 'duration': 9.064}, {'end': 1314.637, 'text': 'So say that you want to know if the laptop has numpad or not, because some laptops are not having the numpad on the right side of the keyboard.', 'start': 1304.473, 'duration': 10.164}, {'end': 1320.26, 'text': 'But this is not a realistic attribute that you will want to assign to a phone.', 'start': 1315.057, 'duration': 5.203}], 'summary': 'You can assign attributes to specific instances individually, e.g. numpad on laptops but not on phones.', 'duration': 25.251, 'max_score': 1295.009, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs1295009.jpg'}, {'end': 1411.891, 'src': 'embed', 'start': 1379.314, 'weight': 4, 'content': [{'end': 1384.397, 'text': 'And I know that I repeated this couple of times, but this is where I fail to understand classes.', 'start': 1379.314, 'duration': 5.083}, {'end': 1388.139, 'text': 'So that is why it is very important to understand this behavior.', 'start': 1384.537, 'duration': 3.602}, {'end': 1391.962, 'text': 'And we already know that the object itself passed as an argument.', 'start': 1388.34, 'duration': 3.622}, {'end': 1393.843, 'text': "So that's why we receive itself.", 'start': 1392.002, 'duration': 1.841}, {'end': 1402.947, 'text': 'And so this means that now we could just return self dot price multiplied by self dot quantity.', 'start': 1394.503, 'duration': 8.444}, {'end': 1411.891, 'text': "And this will mean that we don't really have to receive those parameters, because we assign those attributes once the instances has been created.", 'start': 1403.407, 'duration': 8.484}], 'summary': 'Understanding classes is important for behavior. object passed as argument. attributes assigned once instance created.', 'duration': 32.577, 'max_score': 1379.314, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs1379314.jpg'}, {'end': 1675.384, 'src': 'embed', 'start': 1650.2, 'weight': 0, 'content': [{'end': 1660.882, 'text': 'Now assert is a statement keyword that is used to check if there is a match between what is happening to your expectations.', 'start': 1650.2, 'duration': 10.682}, {'end': 1663.682, 'text': "So let's see how we can get work with assert.", 'start': 1661.302, 'duration': 2.38}, {'end': 1665.823, 'text': "So I'm actually going to delete this from here.", 'start': 1663.802, 'duration': 2.021}, {'end': 1675.384, 'text': "And I'm going to organize our init method a little bit, I'm going to say here, a comment, and I will say assign to self object.", 'start': 1666.423, 'duration': 8.961}], 'summary': "The 'assert' statement is used to check for matches and can be worked with to organize code and assign to objects.", 'duration': 25.184, 'max_score': 1650.2, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs1650200.jpg'}], 'start': 708.723, 'title': 'Object-oriented programming best practices', 'summary': 'Covers implementing oop best practices, including dynamic attribute assignment in python, understanding classes and constructors, with examples and demonstrations, addressing issues such as hard coding attributes, and differentiating between mandatory and non-mandatory parameters.', 'chapters': [{'end': 988.493, 'start': 708.723, 'title': 'Oop best practices', 'summary': 'Discusses implementing oop best practices, addressing problems such as hard coding attributes and demonstrating the use of the double underscore init method, which automatically executes when creating an instance of a class.', 'duration': 279.77, 'highlights': ["The double underscore init method is a special method used in OOP to automatically execute when creating an instance of a class, as demonstrated by the print statement 'I am created' being called twice for two instances. The double underscore init method is used in OOP to automatically execute when creating an instance of a class, as demonstrated by the print statement 'I am created' being called twice for two instances.", 'Addressing the problem of hard coding attributes, the chapter explains how the double underscore init method can be utilized to avoid creating attributes hard coded for each instance. The chapter explains how the double underscore init method can be utilized to avoid creating attributes hard coded for each instance, solving the problem of hard coding attributes.', 'Discussing the need for a set of rules for attributes required to instantiate an instance successfully, the chapter highlights the importance of declaring in the class that specific attributes must be passed for successful instantiation. The chapter highlights the need for a set of rules for attributes required to instantiate an instance successfully, emphasizing the importance of declaring in the class that specific attributes must be passed for successful instantiation.']}, {'end': 1336.311, 'start': 988.493, 'title': 'Dynamic attribute assignment in python', 'summary': 'Demonstrates dynamic attribute assignment in python by utilizing the double underscore init method to assign attributes to instances and differentiating between mandatory and non-mandatory parameters, with examples of assigning default values and assigning attributes to specific instances individually.', 'duration': 347.818, 'highlights': ['The chapter demonstrates using the double underscore init method to dynamically assign attributes to Python instances, allowing for unique attribute assignment for each instance. The chapter illustrates using the double underscore init method to dynamically assign attributes to Python instances, enabling unique attribute assignment for each instance, providing a clear understanding of dynamic attribute assignment.', 'The chapter showcases differentiating between mandatory and non-mandatory parameters, enabling default values for certain attributes such as quantity, demonstrating realistic scenarios and flexibility in attribute assignment. The chapter highlights differentiating between mandatory and non-mandatory parameters, allowing default values for attributes such as quantity, showcasing realism and flexibility in attribute assignment.', 'The chapter emphasizes the ability to assign attributes to specific instances individually, providing the flexibility to assign unique attributes to specific instances. The chapter emphasizes the ability to assign attributes to specific instances individually, showcasing the flexibility to assign unique attributes to specific instances.']}, {'end': 1838.06, 'start': 1336.751, 'title': 'Understanding classes and constructors', 'summary': 'Explains the concept of classes and constructors, including the use of attribute assignments, parameter passing, data typing, and validation using assert statements, with specific examples and explanation.', 'duration': 501.309, 'highlights': ['The chapter explains the concept of classes and constructors, including the use of attribute assignments, parameter passing, data typing, and validation using assert statements. The transcript covers an explanation of classes and constructors, including attribute assignments, parameter passing, data typing, and validation using assert statements.', 'The importance of understanding behavior related to object passing and parameter receiving in classes is emphasized. The importance of understanding object passing and parameter receiving in classes is emphasized, highlighting the significance of behavior related to these concepts.', 'Examples and demonstrations are provided to illustrate the use of data typing for parameters and the unique characteristics of float and integer data types. The transcript provides examples and demonstrations to illustrate the use of data typing for parameters and the unique characteristics of float and integer data types.', 'The use of assert statements for validating received arguments is explained, including the ability to add custom exception messages for better understanding of assertion errors. The use of assert statements for validating received arguments is explained, highlighting the ability to add custom exception messages for better understanding of assertion errors.']}], 'duration': 1129.337, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs708723.jpg', 'highlights': ['The chapter explains the concept of classes and constructors, including the use of attribute assignments, parameter passing, data typing, and validation using assert statements.', 'The chapter demonstrates using the double underscore init method to dynamically assign attributes to Python instances, allowing for unique attribute assignment for each instance.', 'The chapter emphasizes the ability to assign attributes to specific instances individually, providing the flexibility to assign unique attributes to specific instances.', 'The chapter showcases differentiating between mandatory and non-mandatory parameters, enabling default values for certain attributes such as quantity, demonstrating realistic scenarios and flexibility in attribute assignment.', 'The importance of understanding behavior related to object passing and parameter receiving in classes is emphasized.']}, {'end': 2565.761, 'segs': [{'end': 1934.308, 'src': 'embed', 'start': 1904.468, 'weight': 0, 'content': [{'end': 1911.131, 'text': 'And that is a good candidate for creating an attribute that is going to be shared across all the instances.', 'start': 1904.468, 'duration': 6.663}, {'end': 1915.995, 'text': 'Now we call those kind of attributes class attributes.', 'start': 1911.591, 'duration': 4.404}, {'end': 1922.319, 'text': 'And the kind of attribute that we have learned till this point is actually called in a full name instance attributes.', 'start': 1916.395, 'duration': 5.924}, {'end': 1926.703, 'text': 'So about instance attributes, we know everything and we learned how to work with it.', 'start': 1922.7, 'duration': 4.003}, {'end': 1934.308, 'text': 'But we did not work it with the other kind of the attributes, which we will do in this tutorial, which is called again a class attribute.', 'start': 1927.043, 'duration': 7.265}], 'summary': 'Learning about class attributes for shared instance data.', 'duration': 29.84, 'max_score': 1904.468, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs1904468.jpg'}, {'end': 2077.376, 'src': 'embed', 'start': 2050.356, 'weight': 1, 'content': [{'end': 2057.222, 'text': "Now, if I was to run that, then you're going to see that we still have the access to see that class attribute.", 'start': 2050.356, 'duration': 6.866}, {'end': 2058.803, 'text': 'Well, that might be confusing.', 'start': 2057.362, 'duration': 1.441}, {'end': 2061.985, 'text': 'And that might be hard to understand why that is happening.', 'start': 2059.263, 'duration': 2.722}, {'end': 2067.009, 'text': 'Well, there is actually something that we need to understand when we work with instances in Python.', 'start': 2062.386, 'duration': 4.623}, {'end': 2077.376, 'text': 'So when we have an instance on our hand, then at first this instance tries to bring the attribute from the instance level at first stage,', 'start': 2067.309, 'duration': 10.067}], 'summary': 'In python, instances bring attributes from the instance level first.', 'duration': 27.02, 'max_score': 2050.356, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2050356.jpg'}, {'end': 2164.411, 'src': 'embed', 'start': 2137.361, 'weight': 2, 'content': [{'end': 2142.343, 'text': 'that you can go ahead and see all the attributes that are belonging to that specific object.', 'start': 2137.361, 'duration': 4.982}, {'end': 2150.226, 'text': 'And that is achievable by using this double underscore di CT double underscore like that.', 'start': 2142.823, 'duration': 7.403}, {'end': 2156.468, 'text': 'So this will go ahead and try to bring you all the attributes that are belonging to the object,', 'start': 2150.726, 'duration': 5.742}, {'end': 2159.289, 'text': 'that you apply this attribute and want to see its content.', 'start': 2156.468, 'duration': 2.821}, {'end': 2164.411, 'text': 'So I will go ahead and copy this one and paste this in for the instance level as well.', 'start': 2159.769, 'duration': 4.642}], 'summary': 'Access object attributes using double underscore di ct double underscore.', 'duration': 27.05, 'max_score': 2137.361, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2137361.jpg'}, {'end': 2531.016, 'src': 'embed', 'start': 2507.069, 'weight': 4, 'content': [{'end': 2513.597, 'text': 'And specifically for creating a method like apply discount, it is a great idea to access it from the instance level.', 'start': 2507.069, 'duration': 6.528}, {'end': 2519.523, 'text': 'So you also allow the option of using a pay rate that is assigned to the instance level.', 'start': 2514.057, 'duration': 5.466}, {'end': 2526.851, 'text': "Okay, so now that we understood completely about the differences between a class to an instance attribute, let's jump ahead to the next topic.", 'start': 2520.124, 'duration': 6.727}, {'end': 2531.016, 'text': 'Now you see that I have deleted those print lines that I have down below.', 'start': 2527.392, 'duration': 3.624}], 'summary': "Access 'apply discount' method from instance level, using instance level pay rate.", 'duration': 23.947, 'max_score': 2507.069, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2507069.jpg'}], 'start': 1838.42, 'title': 'Python class and instance attributes', 'summary': 'Covers class attributes in python, explaining usage, access from both class and instance levels, and the relationship between class and instance attributes. it also explains magic attributes, method creation within a class, applying discounts, and accessing class attributes at the instance level, emphasizing their importance in method creation.', 'chapters': [{'end': 2184.703, 'start': 1838.42, 'title': 'Python class attributes tutorial', 'summary': 'Covers the concept of class attributes in python, explaining their usage, access from both class and instance levels, and the relationship between class and instance attributes.', 'duration': 346.283, 'highlights': ['Class attributes are attributes that belong to the class itself and can be accessed from both the class and instance levels. The chapter explains the concept of class attributes and how they can be accessed from both the class and instance levels, providing clarity on their usage.', 'Instances first try to access attributes from the instance level, and if not found, they retrieve them from the class level. Instances in Python first attempt to retrieve attributes from the instance level, and if not found, they search for them at the class level, which clarifies the behavior of attribute access.', "The 'double underscore dict double underscore' attribute can be used to view all the attributes belonging to a specific object. A built-in magic attribute, '__dict__', allows users to view all the attributes belonging to a specific object, providing a way to inspect the object's content."]}, {'end': 2565.761, 'start': 2185.063, 'title': 'Understanding class and instance attributes', 'summary': 'Explains the usage of magic attributes and method creation within a class, including overriding instance attributes, with a focus on applying discounts and accessing class attributes at the instance level, and emphasizes the importance of accessing class attributes while creating methods, including the recommendation to access them from the instance level.', 'duration': 380.698, 'highlights': ['The chapter explores the usage of magic attributes and method creation within a class, emphasizing the importance of accessing class attributes at the instance level when creating methods.', "The method 'apply discount' is demonstrated to override the price attribute for instances, with examples of assigning different discount amounts to specific items using instance attributes.", 'The significance of accessing class attributes at the instance level is highlighted, with the recommendation to access them from the instance level while creating methods.']}], 'duration': 727.341, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs1838420.jpg', 'highlights': ['The chapter explains the concept of class attributes and how they can be accessed from both the class and instance levels, providing clarity on their usage.', 'Instances in Python first attempt to retrieve attributes from the instance level, and if not found, they search for them at the class level, which clarifies the behavior of attribute access.', "A built-in magic attribute, '__dict__', allows users to view all the attributes belonging to a specific object, providing a way to inspect the object's content.", 'The chapter explores the usage of magic attributes and method creation within a class, emphasizing the importance of accessing class attributes at the instance level when creating methods.', "The method 'apply discount' is demonstrated to override the price attribute for instances, with examples of assigning different discount amounts to specific items using instance attributes.", 'The significance of accessing class attributes at the instance level is highlighted, with the recommendation to access them from the instance level while creating methods.']}, {'end': 3241.096, 'segs': [{'end': 2789.685, 'src': 'heatmap', 'start': 2620.386, 'weight': 0.919, 'content': [{'end': 2628.592, 'text': "Now we need to figure out how we are going to add our instances for each time that we're going to go ahead and create an instance.", 'start': 2620.386, 'duration': 8.206}, {'end': 2637.379, 'text': 'Now if you remember, the double underscore init method is being called immediately once the instance has been created.', 'start': 2628.972, 'duration': 8.407}, {'end': 2650.624, 'text': 'So it might be a wonderful idea going down below inside this double underscore init method and use a code that will be responsible to append to that list every time that we create an instance.', 'start': 2637.819, 'duration': 12.805}, {'end': 2654.285, 'text': 'And that will be as easy as saying something like the following.', 'start': 2650.924, 'duration': 3.361}, {'end': 2660.506, 'text': 'So first you could pay attention that I actually wrote some commands in this double underscore init function,', 'start': 2654.725, 'duration': 5.781}, {'end': 2663.787, 'text': 'like run validations and assigned to self object.', 'start': 2660.506, 'duration': 3.281}, {'end': 2670.193, 'text': 'So it might be a great idea to start with a comment here that will say actions to execute,', 'start': 2664.147, 'duration': 6.046}, {'end': 2673.896, 'text': 'just to really have a great separation between the different things that we are doing.', 'start': 2670.193, 'duration': 3.703}, {'end': 2681.062, 'text': 'So now inside here, I can say item dot all and you can see that I use the class object first.', 'start': 2674.317, 'duration': 6.745}, {'end': 2682.964, 'text': 'And then that is a list.', 'start': 2681.523, 'duration': 1.441}, {'end': 2685.366, 'text': 'So I can use dot append.', 'start': 2683.084, 'duration': 2.282}, {'end': 2689.35, 'text': 'And then I will just append the self object.', 'start': 2685.867, 'duration': 3.483}, {'end': 2695.252, 'text': 'Now we know that self is actually the instance itself every time that it is being created.', 'start': 2689.73, 'duration': 5.522}, {'end': 2704.756, 'text': 'So, once we go ahead and launch such a command inside the init function, then for each instance that is going to be created,', 'start': 2695.693, 'duration': 9.063}, {'end': 2708.238, 'text': 'this all list is going to be filled with our instances.', 'start': 2704.756, 'duration': 3.482}, {'end': 2717.882, 'text': 'Now to show you that I can jump a line after we create the instances, and we can say print item dot all.', 'start': 2708.618, 'duration': 9.264}, {'end': 2725.724, 'text': "And now if I was to run our program, then you're going to see that we're going to have a list with five instances.", 'start': 2718.502, 'duration': 7.222}, {'end': 2730.826, 'text': 'If I was to scroll right a bit, then you can see that I have exactly five elements.', 'start': 2726.245, 'duration': 4.581}, {'end': 2732.507, 'text': 'And that is perfect.', 'start': 2731.226, 'duration': 1.281}, {'end': 2739.39, 'text': "Now that's going to be extremely useful if you want to do something with only one of the attributes of your instances.", 'start': 2733.067, 'duration': 6.323}, {'end': 2747.894, 'text': "So say that you'd like to print all the names for all of your instances, then you can use easily a for loop to achieve such a task.", 'start': 2739.79, 'duration': 8.104}, {'end': 2753.978, 'text': 'So we can go ahead and say for instance in item dot all.', 'start': 2748.254, 'duration': 5.724}, {'end': 2757.801, 'text': 'And you can say print instance dot name.', 'start': 2754.498, 'duration': 3.303}, {'end': 2764.066, 'text': 'And once we come up with this, then you can see that we have all the names for all the instances that we have created.', 'start': 2758.241, 'duration': 5.825}, {'end': 2770.652, 'text': 'So that is going to be useful here and there, especially if you know how to use the filter function, for example,', 'start': 2764.467, 'duration': 6.185}, {'end': 2775.396, 'text': 'to apply some special things on some of the instances that are matching your criteria.', 'start': 2770.652, 'duration': 4.744}, {'end': 2782.12, 'text': "Alright, so now that we understood this, then let's also take care of one problem that we saw previously.", 'start': 2775.936, 'duration': 6.184}, {'end': 2789.685, 'text': 'Now, if I was to use a Ctrl Z couple of times and still use this print item dot all now,', 'start': 2782.56, 'duration': 7.125}], 'summary': 'Using double underscore init method to create and append instances to a list, resulting in a list with five instances, which can be utilized for various tasks.', 'duration': 169.299, 'max_score': 2620.386, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2620386.jpg'}, {'end': 2717.882, 'src': 'embed', 'start': 2685.867, 'weight': 2, 'content': [{'end': 2689.35, 'text': 'And then I will just append the self object.', 'start': 2685.867, 'duration': 3.483}, {'end': 2695.252, 'text': 'Now we know that self is actually the instance itself every time that it is being created.', 'start': 2689.73, 'duration': 5.522}, {'end': 2704.756, 'text': 'So, once we go ahead and launch such a command inside the init function, then for each instance that is going to be created,', 'start': 2695.693, 'duration': 9.063}, {'end': 2708.238, 'text': 'this all list is going to be filled with our instances.', 'start': 2704.756, 'duration': 3.482}, {'end': 2717.882, 'text': 'Now to show you that I can jump a line after we create the instances, and we can say print item dot all.', 'start': 2708.618, 'duration': 9.264}], 'summary': "Appending self object fills 'all' list for each created instance.", 'duration': 32.015, 'max_score': 2685.867, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2685867.jpg'}, {'end': 3007.711, 'src': 'embed', 'start': 2980.877, 'weight': 1, 'content': [{'end': 2990.001, 'text': 'Now you might be curious why I worked so hard to return the representative version of our objects the same way that we create them.', 'start': 2980.877, 'duration': 9.124}, {'end': 2994.023, 'text': "So that is just the best practice according to Python's documentations,", 'start': 2990.381, 'duration': 3.642}, {'end': 3001.586, 'text': 'because it will help us to create instances immediately by only the effort of copying and pasting this to a Python console.', 'start': 2994.023, 'duration': 7.563}, {'end': 3007.711, 'text': 'So, if you think about it right now, if you open a Python console and you import this class,', 'start': 3001.946, 'duration': 5.765}], 'summary': 'Best practice in python: return representative objects for easy instance creation.', 'duration': 26.834, 'max_score': 2980.877, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2980877.jpg'}, {'end': 3049.512, 'src': 'embed', 'start': 3026.505, 'weight': 0, 'content': [{'end': 3034.647, 'text': 'And you can see that it is very easy to identify the instances of our class with this list and with this approach.', 'start': 3026.505, 'duration': 8.142}, {'end': 3040.189, 'text': 'Alright, so until this point, we understood how we can change the way that we represent our objects.', 'start': 3034.908, 'duration': 5.281}, {'end': 3049.512, 'text': 'And we also understood how we can access to all of our instances by this class attribute that we intentionally named all.', 'start': 3040.649, 'duration': 8.863}], 'summary': 'Demonstrates easy identification of class instances and access to all instances using a class attribute.', 'duration': 23.007, 'max_score': 3026.505, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3026505.jpg'}, {'end': 3123.36, 'src': 'embed', 'start': 3091.774, 'weight': 3, 'content': [{'end': 3095.056, 'text': 'But I want to keep things more simple for the purposes of this tutorial.', 'start': 3091.774, 'duration': 3.282}, {'end': 3100.3, 'text': "And that is why I'm going to use something that is called CSV that you might have heard of.", 'start': 3095.397, 'duration': 4.903}, {'end': 3103.824, 'text': 'CSV stands for comma separated values.', 'start': 3100.9, 'duration': 2.924}, {'end': 3107.688, 'text': 'So this means that you could go ahead and use a CSV file.', 'start': 3104.024, 'duration': 3.664}, {'end': 3116.358, 'text': 'And you could store your values as comma separated where each line will represent a single structured data.', 'start': 3108.088, 'duration': 8.27}, {'end': 3123.36, 'text': 'And CSV is a great option here because it allows the data to be saved in a table structured format.', 'start': 3116.738, 'duration': 6.622}], 'summary': 'Using csv for data storage, enables table structured format.', 'duration': 31.586, 'max_score': 3091.774, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3091774.jpg'}], 'start': 2566.201, 'title': 'Managing class instances and custom object representation', 'summary': 'Covers managing class instances with a list in python and customizing object representation using the __repr__ method. it also delves into csv file handling for storing and visualizing structured data, emphasizing the benefits of csv.', 'chapters': [{'end': 2775.396, 'start': 2566.201, 'title': 'Managing class instances with a list', 'summary': 'Explains how to create a list of class instances in python, allowing easy access and manipulation of the instances. it demonstrates the process of adding instances to the list and utilizing the list for various operations.', 'duration': 209.195, 'highlights': ["Creating a list 'all' to store class instances The chapter introduces the concept of creating a class attribute 'all' to store instances, streamlining access and management of all created instances.", "Appending instances to the 'all' list The process of appending instances to the 'all' list within the '__init__' method is detailed, demonstrating how the list is dynamically populated with each new instance created.", "Utilizing the list for operations on instances The chapter showcases the practical utility of the 'all' list, such as accessing specific attributes of instances through a loop, and highlights its usefulness for targeted operations on instances."]}, {'end': 3241.096, 'start': 2775.936, 'title': 'Custom object representation and csv file handling', 'summary': 'Explains how to customize the representation of objects using the __repr__ method in python, and then discusses the use of csv files to store and manage structured data, demonstrating the benefits of csv in maintaining data and visualizing it in a table format.', 'duration': 465.16, 'highlights': ['Customizing Object Representation with __repr__ Method The chapter explains the use of the __repr__ method to customize the representation of objects by returning a unique string for each instance, allowing for easy identification and immediate instance creation in Python console.', 'Benefits of Using CSV for Data Maintenance Demonstrates the advantages of using a CSV file to store and manage structured data, highlighting its capability to represent data in a table format, making it easier to visualize and maintain the data.']}], 'duration': 674.895, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs2566201.jpg', 'highlights': ["Creating a list 'all' to store class instances The chapter introduces the concept of creating a class attribute 'all' to store instances, streamlining access and management of all created instances.", 'Customizing Object Representation with __repr__ Method The chapter explains the use of the __repr__ method to customize the representation of objects by returning a unique string for each instance, allowing for easy identification and immediate instance creation in Python console.', "Appending instances to the 'all' list The process of appending instances to the 'all' list within the '__init__' method is detailed, demonstrating how the list is dynamically populated with each new instance created.", 'Benefits of Using CSV for Data Maintenance Demonstrates the advantages of using a CSV file to store and manage structured data, highlighting its capability to represent data in a table format, making it easier to visualize and maintain the data.', "Utilizing the list for operations on instances The chapter showcases the practical utility of the 'all' list, such as accessing specific attributes of instances through a loop, and highlights its usefulness for targeted operations on instances."]}, {'end': 4150.218, 'segs': [{'end': 3373.132, 'src': 'embed', 'start': 3346.86, 'weight': 1, 'content': [{'end': 3351.543, 'text': 'And I know that we have errors, but we are going to solve each one of those just in a second.', 'start': 3346.86, 'duration': 4.683}, {'end': 3361.547, 'text': 'Now in order to convert this to a class method, we need to use a decorator that will be responsible to convert this method into a class method.', 'start': 3352.063, 'duration': 9.484}, {'end': 3373.132, 'text': 'Now decorators in Python is just a quick way to change the behavior of the functions that we will write by basically calling them just before the line that we create our function.', 'start': 3361.787, 'duration': 11.345}], 'summary': 'Errors will be solved; using decorator to convert method to class method in python.', 'duration': 26.272, 'max_score': 3346.86, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3346860.jpg'}, {'end': 3486.927, 'src': 'embed', 'start': 3461.125, 'weight': 0, 'content': [{'end': 3467.571, 'text': "Now I'm going to go up top first, and I'm going to import a library that is called CSV.", 'start': 3461.125, 'duration': 6.446}, {'end': 3476.619, 'text': 'So I will go here and I will use an import CSV line, because that will be the library that will take full responsibility to read the CSV file.', 'start': 3467.771, 'duration': 8.848}, {'end': 3480.123, 'text': 'And then we will see how we can instantiate some objects.', 'start': 3477.16, 'duration': 2.963}, {'end': 3486.927, 'text': 'Alright, so now I can go ahead and use a context manager to read the items dot CSV file.', 'start': 3480.623, 'duration': 6.304}], 'summary': 'Imported csv library to read and instantiate objects for items.csv file.', 'duration': 25.802, 'max_score': 3461.125, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3461125.jpg'}, {'end': 3666.286, 'src': 'heatmap', 'start': 3578.146, 'weight': 0.831, 'content': [{'end': 3582.989, 'text': "Alright, so now that we understood this, then let's go ahead and see what we have in those lines.", 'start': 3578.146, 'duration': 4.843}, {'end': 3589.273, 'text': 'So after our class definition, we only go ahead and call this item dot instantiate from CSV metal.', 'start': 3583.149, 'duration': 6.124}, {'end': 3596.057, 'text': 'So if I was to run that, then you can see that I received some dictionaries in separated lines.', 'start': 3589.753, 'duration': 6.304}, {'end': 3600.3, 'text': 'And that is because I iterate over a list of dictionaries in here.', 'start': 3596.457, 'duration': 3.843}, {'end': 3601.921, 'text': 'And that is just perfect.', 'start': 3600.72, 'duration': 1.201}, {'end': 3606.785, 'text': 'Alright, so the only thing that we miss right now is creating instances.', 'start': 3602.481, 'duration': 4.304}, {'end': 3614.15, 'text': 'Now besides printing those, then we could now say something like item and open up and close parentheses.', 'start': 3607.205, 'duration': 6.945}, {'end': 3617.513, 'text': 'And this should be enough to instantiate our instances.', 'start': 3614.611, 'duration': 2.902}, {'end': 3624.979, 'text': 'Now I can go ahead and pass my arguments in here by basically reading the keys from a dictionary.', 'start': 3618.014, 'duration': 6.965}, {'end': 3629.803, 'text': 'So I can say name is equal to item dot get.', 'start': 3625.36, 'duration': 4.443}, {'end': 3633.045, 'text': 'And that will receive name.', 'start': 3630.544, 'duration': 2.501}, {'end': 3640.449, 'text': 'And now I can add a comma and duplicate this line twice and change those accordingly.', 'start': 3633.546, 'duration': 6.903}, {'end': 3641.87, 'text': 'So this will be price.', 'start': 3640.549, 'duration': 1.321}, {'end': 3644.311, 'text': 'And this will be quantity.', 'start': 3642.51, 'duration': 1.801}, {'end': 3647.353, 'text': 'And now I need to replace my key names.', 'start': 3644.692, 'duration': 2.661}, {'end': 3649.074, 'text': 'So it will be price here.', 'start': 3647.533, 'duration': 1.541}, {'end': 3652.156, 'text': 'and then quantity right there.', 'start': 3649.714, 'duration': 2.442}, {'end': 3657.159, 'text': "And now let's go ahead and see what will happen if I was to call this method.", 'start': 3652.656, 'duration': 4.503}, {'end': 3666.286, 'text': 'And as well as calling the attribute of item dot all, because this one stores all the instances inside the list.', 'start': 3657.7, 'duration': 8.586}], 'summary': 'Iterating over dictionaries to instantiate instances and accessing attributes.', 'duration': 88.14, 'max_score': 3578.146, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3578146.jpg'}, {'end': 3785.177, 'src': 'embed', 'start': 3762.023, 'weight': 2, 'content': [{'end': 3769.387, 'text': "And that is the only way to get over this because we don't want to convert the price to an integer directly because it could be float.", 'start': 3762.023, 'duration': 7.364}, {'end': 3773.268, 'text': 'So now we could go ahead and execute.', 'start': 3769.827, 'duration': 3.441}, {'end': 3775.41, 'text': 'And you can see that now it works perfectly.', 'start': 3773.288, 'duration': 2.122}, {'end': 3780.874, 'text': 'Although we see the prices as 100.0.', 'start': 3775.87, 'duration': 5.004}, {'end': 3783.596, 'text': 'But that is something that we will look into it in the future.', 'start': 3780.874, 'duration': 2.722}, {'end': 3785.177, 'text': 'But for now it works perfect.', 'start': 3783.676, 'duration': 1.501}], 'summary': 'The code successfully executes without converting price to an integer, displaying prices as 100.0.', 'duration': 23.154, 'max_score': 3762.023, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3762023.jpg'}, {'end': 3826.67, 'src': 'embed', 'start': 3801.763, 'weight': 3, 'content': [{'end': 3810.085, 'text': 'So for example, if you want to check if a number is an integer or a float, then this is a good candidate for creating a static method.', 'start': 3801.763, 'duration': 8.322}, {'end': 3814.066, 'text': 'Because this has some connection to the class that we work with.', 'start': 3810.485, 'duration': 3.581}, {'end': 3819.628, 'text': 'So it makes sense to check if a price of an item has a decimal point.', 'start': 3814.406, 'duration': 5.222}, {'end': 3826.67, 'text': 'And by saying has a decimal point, I obviously count out those that are point zero.', 'start': 3820.088, 'duration': 6.582}], 'summary': 'Creating a static method to check if a number is an integer or float based on class connection.', 'duration': 24.907, 'max_score': 3801.763, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3801763.jpg'}, {'end': 3947.016, 'src': 'embed', 'start': 3917.481, 'weight': 4, 'content': [{'end': 3923.045, 'text': 'But with static methods, we never send the object as the first argument.', 'start': 3917.481, 'duration': 5.564}, {'end': 3933.63, 'text': 'So that is why we should relate to the static method like a regular function that just receives parameters like we are familiar with isolated functions.', 'start': 3923.325, 'duration': 10.305}, {'end': 3936.631, 'text': 'Now I will go deeper on this just in a few minutes.', 'start': 3934.09, 'duration': 2.541}, {'end': 3939.612, 'text': "But let's go ahead and finish up our static method first.", 'start': 3936.731, 'duration': 2.881}, {'end': 3947.016, 'text': 'So this should receive num as one parameter because we should receive at least something to check if it is an integer or not.', 'start': 3940.032, 'duration': 6.984}], 'summary': 'Static methods do not require the object as the first argument, behaving like regular functions. they should receive at least one parameter to check if it is an integer.', 'duration': 29.535, 'max_score': 3917.481, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3917481.jpg'}, {'end': 4078.97, 'src': 'embed', 'start': 4048.401, 'weight': 5, 'content': [{'end': 4055.923, 'text': 'And so the is underscore integer should check if the point is zero, and should return false accordingly.', 'start': 4048.401, 'duration': 7.522}, {'end': 4061.664, 'text': 'Now I will also use an else if statement here to basically check if it is integer by itself.', 'start': 4056.103, 'duration': 5.561}, {'end': 4072.688, 'text': 'So I will say l if is instance num, and check if it is an instance of an integer, then I will just return true.', 'start': 4061.945, 'duration': 10.743}, {'end': 4078.97, 'text': 'And if it is just something else, then I will just say, return false like that.', 'start': 4073.388, 'duration': 5.582}], 'summary': 'The function checks if the input is an integer and returns true if it is, false otherwise.', 'duration': 30.569, 'max_score': 4048.401, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs4048401.jpg'}], 'start': 3241.596, 'title': 'Methods, static methods, and integer check', 'summary': 'Covers designing class methods for csv file instantiation, understanding static methods, and checking if a number is an integer, including handling data type conversion issues, logical connection of static methods to a class, and utilizing if statements and the is_integer function.', 'chapters': [{'end': 3785.177, 'start': 3241.596, 'title': 'Designing class methods for csv file instantiation', 'summary': 'Covers the conversion of a method into a class method, utilizing the csv library to read and instantiate objects from a csv file, and handling data type conversion issues to ensure successful instantiation.', 'duration': 543.581, 'highlights': ['Utilizing the CSV library to read and instantiate objects from a CSV file The transcript explains the use of the CSV library to read and convert the content of a CSV file into a list of dictionaries, which is then utilized to instantiate objects.', 'Conversion of a method into a class method The chapter discusses the conversion of a method into a class method using a decorator, enabling access from the class level only and passing the class reference as the first argument.', 'Handling data type conversion issues to ensure successful instantiation The transcript demonstrates the process of handling data type conversion issues, such as converting strings to integers or floats, to ensure successful instantiation of objects from the CSV file.']}, {'end': 3939.612, 'start': 3785.338, 'title': 'Understanding static methods', 'summary': 'Explains the concept of static methods, highlighting their logical connection to a class, their similarity to class methods, but their distinction in not sending the object as the first argument.', 'duration': 154.274, 'highlights': ['Static methods have a logical connection to a class, such as checking if a number is an integer or a float. Static methods are suitable for tasks with a logical connection to the class, like checking if a number is an integer or a float.', 'Static methods are similar to class methods but do not send the object as the first argument. Static methods resemble class methods but differ in not sending the object as the first argument, unlike class methods.', 'Explanation of how static methods are defined and used with decorators like @staticmethod. The explanation of defining static methods using decorators like @staticmethod is provided in the chapter.']}, {'end': 4150.218, 'start': 3940.032, 'title': 'Checking if a number is an integer', 'summary': 'Discusses a method for determining if a number is an integer, utilizing if statements and the is_integer function, where passing in 7 would return true and 7.5 would return false.', 'duration': 210.186, 'highlights': ['Utilizing if statements and the is_integer function to check if a number is an integer, where passing in 7 would return true and 7.5 would return false.', 'Using the is_instance function to check if the received parameter is an instance of a float or an integer, and returning false accordingly.']}], 'duration': 908.622, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs3241596.jpg', 'highlights': ['Utilizing the CSV library to read and instantiate objects from a CSV file', 'Conversion of a method into a class method using a decorator', 'Handling data type conversion issues to ensure successful instantiation', 'Static methods have a logical connection to a class, such as checking if a number is an integer or a float', 'Static methods are similar to class methods but do not send the object as the first argument', 'Utilizing if statements and the is_integer function to check if a number is an integer']}, {'end': 5137.43, 'segs': [{'end': 4326.397, 'src': 'embed', 'start': 4299.68, 'weight': 3, 'content': [{'end': 4313.869, 'text': 'Now, the only main difference between a class method and to a static method is the fact that static methods are not passing the object reference as the first argument in the background.', 'start': 4299.68, 'duration': 14.189}, {'end': 4320.893, 'text': "it is noticeable from the fact that we don't have a special highlight purple in my case for the first parameter.", 'start': 4313.869, 'duration': 7.024}, {'end': 4326.397, 'text': 'So, if you remember, if I was to go ahead and use here a first parameter like num,', 'start': 4321.314, 'duration': 5.083}], 'summary': "Static methods don't pass object reference as first argument.", 'duration': 26.717, 'max_score': 4299.68, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs4299680.jpg'}, {'end': 4564.321, 'src': 'embed', 'start': 4538.698, 'weight': 0, 'content': [{'end': 4545.443, 'text': 'And that is exactly where we could benefit from inheritance and we could go ahead and create a separated class that we could name phone.', 'start': 4538.698, 'duration': 6.745}, {'end': 4553.891, 'text': 'And then this phone class will inherit all the methods and all the attributes that item class has.', 'start': 4545.864, 'duration': 8.027}, {'end': 4556.173, 'text': "So let's go ahead and simulate that.", 'start': 4554.291, 'duration': 1.882}, {'end': 4559.096, 'text': "So I'm not going to delete the instances yet.", 'start': 4556.553, 'duration': 2.543}, {'end': 4564.321, 'text': "But I'm going to go ahead here and create a class that I will name it phone.", 'start': 4559.236, 'duration': 5.085}], 'summary': 'Creating a phone class to inherit methods and attributes from item class.', 'duration': 25.623, 'max_score': 4538.698, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs4538698.jpg'}, {'end': 4705.348, 'src': 'embed', 'start': 4676.002, 'weight': 2, 'content': [{'end': 4680.126, 'text': "Alright, so now let's go ahead and understand some more advanced things about inheritance.", 'start': 4676.002, 'duration': 4.124}, {'end': 4688.594, 'text': 'Now throughout the series, we learned that it is not a great idea to assign attributes manually, once we create those instances.', 'start': 4680.607, 'duration': 7.987}, {'end': 4699.045, 'text': 'And the better way to do that is actually going ahead and creating our constructor and pass the value that we like to immediately in the instance creation,', 'start': 4688.775, 'duration': 10.27}, {'end': 4700.266, 'text': 'exactly like here.', 'start': 4699.045, 'duration': 1.221}, {'end': 4705.348, 'text': "So in order to solve this, then we're going to need to figure out how we are going to do that.", 'start': 4700.786, 'duration': 4.562}], 'summary': 'Learning advanced inheritance and constructor for attribute assignment.', 'duration': 29.346, 'max_score': 4676.002, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs4676002.jpg'}, {'end': 4956.257, 'src': 'embed', 'start': 4931.014, 'weight': 1, 'content': [{'end': 4936.819, 'text': 'And what super allows us to do it allows us to have full access to all the attributes of the parent class.', 'start': 4931.014, 'duration': 5.805}, {'end': 4939.481, 'text': 'And by using the super function.', 'start': 4937.159, 'duration': 2.322}, {'end': 4946.407, 'text': "we don't really need to hard code in the attribute assignment, like we have done with the name, price and quantity and,", 'start': 4939.481, 'duration': 6.926}, {'end': 4953.394, 'text': 'as well as for the other validations that we have executed, every time that we want to come up with a child class.', 'start': 4946.407, 'duration': 6.987}, {'end': 4956.257, 'text': 'Now imagine how hard that is going to be.', 'start': 4953.835, 'duration': 2.422}], 'summary': 'Using super allows full access to parent class attributes, avoiding hard coding and simplifying child class creation.', 'duration': 25.243, 'max_score': 4931.014, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs4931014.jpg'}], 'start': 4150.497, 'title': 'Python inheritance and methods', 'summary': 'Covers the differences between class method and static method in python, the concept and application of inheritance in object-oriented programming, challenges and solutions related to inheritance, and the significance of using the super function, providing specific examples and recommendations.', 'chapters': [{'end': 4405.548, 'start': 4150.497, 'title': 'Python: class method vs static method', 'summary': "Explains the differences between class method and static method in python, highlighting that static methods are used for non-unique tasks, while class methods are used for instantiating instances from structured data. it also clarifies that static methods do not pass the object reference as the first argument, and mentions that both can be called from the instance level, but it's recommended to avoid doing so.", 'duration': 255.051, 'highlights': ['The main difference between a class method and a static method is that static methods are used for non-unique tasks, while class methods are used for instantiating instances from structured data.', 'Static methods do not pass the object reference as the first argument, which is the main distinction from class methods.', "Both class methods and static methods can be called from the instance level, but it's recommended to avoid doing so to prevent confusion."]}, {'end': 4675.542, 'start': 4406.028, 'title': 'Inheritance in object-oriented programming', 'summary': "Introduces the concept of inheritance in object-oriented programming, demonstrating its application in creating child classes like 'phone' inheriting from the parent class 'item' to represent different kinds of objects, and the significance of inheritance in representing realistic attributes and functionalities for various items.", 'duration': 269.514, 'highlights': ["Inheritance allows the creation of child classes like 'phone' inheriting from the parent class 'item', providing a way to represent different kinds of objects with shared attributes and methods.", "The chapter emphasizes the significance of inheritance in representing realistic attributes and functionalities for various items, showcasing the potential for creating separate classes like 'laptop' with distinct functionalities inherited from the 'item' class.", 'The concept of parent and child classes is introduced, with parent classes being those from which other classes inherit, and child classes being those that inherit from the parent class, providing a foundational understanding of object-oriented programming terminology and structure.', 'The chapter illustrates the practical application of inheritance in object-oriented programming, demonstrating its use in representing different kinds of objects and realistic programs, providing a fundamental concept for creating and managing classes with shared attributes and methods.']}, {'end': 4907.395, 'start': 4676.002, 'title': 'Inheritance challenges and solutions', 'summary': 'Discusses the challenges of creating a constructor for a child class while maintaining the logic of the parent class, and proposes a solution by incorporating additional attributes and using class attributes to create instances with default values and methods from the parent class.', 'duration': 231.393, 'highlights': ['The challenge of creating a constructor for a child class while maintaining the logic of the parent class is discussed, emphasizing the need to pass additional attributes during instance creation.', "The solution proposed involves incorporating additional attributes like 'broken phones' in the constructor and utilizing class attributes to create instances with default values.", 'The use of class attributes to create instances with default values and methods from the parent class, along with testing the functionality, is demonstrated.']}, {'end': 5137.43, 'start': 4907.975, 'title': 'Using the super function for inheritance', 'summary': 'Discusses the importance of using the super function in python inheritance, highlighting the need to avoid code duplication and the benefits of accessing parent class attributes, with specific examples and warnings.', 'duration': 229.455, 'highlights': ['The super function allows full access to all attributes of the parent class, avoiding the need for hard coding attribute assignments, which would lead to a lot of code duplication.', 'Using the super function in the child class constructor prevents attribute errors and allows for the implementation of best practices in inheritance in object-oriented programs.', 'The double underscore init method in the child class expects special arguments, such as name, price, and quantity, inherited from the parent class, ensuring proper functioning without code duplication.', 'The usage of keyworded arguments could potentially solve the issue of duplicating parameters in the constructor, providing a more advanced solution for the code structure.']}], 'duration': 986.933, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs4150497.jpg', 'highlights': ["Inheritance allows the creation of child classes like 'phone' inheriting from the parent class 'item', providing a way to represent different kinds of objects with shared attributes and methods.", 'The super function allows full access to all attributes of the parent class, avoiding the need for hard coding attribute assignments, which would lead to a lot of code duplication.', 'The challenge of creating a constructor for a child class while maintaining the logic of the parent class is discussed, emphasizing the need to pass additional attributes during instance creation.', 'The main difference between a class method and a static method is that static methods are used for non-unique tasks, while class methods are used for instantiating instances from structured data.']}, {'end': 5582.601, 'segs': [{'end': 5187.063, 'src': 'embed', 'start': 5160.646, 'weight': 2, 'content': [{'end': 5165.09, 'text': 'for each child class that we use a separated constructor.', 'start': 5160.646, 'duration': 4.444}, {'end': 5176.201, 'text': 'we also going to need to call the super function in order to have fully access for all the attributes and methods that are coming from the class that we inherit from.', 'start': 5165.09, 'duration': 11.111}, {'end': 5179.241, 'text': 'Alright, so I minimize the code for our classes.', 'start': 5176.741, 'duration': 2.5}, {'end': 5182.562, 'text': 'And I also left with one instance of phone here.', 'start': 5179.722, 'duration': 2.84}, {'end': 5185.863, 'text': 'Now I want to show you the results of the following things.', 'start': 5183.062, 'duration': 2.801}, {'end': 5187.063, 'text': 'So I will say print.', 'start': 5185.943, 'duration': 1.12}], 'summary': 'Using separate constructors for child classes, accessing attributes and methods from the parent class, and minimizing code for classes.', 'duration': 26.417, 'max_score': 5160.646, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5160646.jpg'}, {'end': 5333.114, 'src': 'heatmap', 'start': 5248.466, 'weight': 0.714, 'content': [{'end': 5257.293, 'text': 'Now if I was to replace this, with some special magic attribute that will be responsible to give me the name of the class, then this will be perfect.', 'start': 5248.466, 'duration': 8.827}, {'end': 5258.734, 'text': "So I'm going to delete that.", 'start': 5257.593, 'duration': 1.141}, {'end': 5261.256, 'text': "And I'm going to use curly brackets.", 'start': 5259.134, 'duration': 2.122}, {'end': 5265.559, 'text': "And I'm going to say self dot double underscore class.", 'start': 5261.336, 'duration': 4.223}, {'end': 5269.122, 'text': 'dot double underscore name.', 'start': 5266.52, 'duration': 2.602}, {'end': 5273.884, 'text': 'So that is a generic way to access to the name of the class from the instance.', 'start': 5269.442, 'duration': 4.442}, {'end': 5279.227, 'text': 'And by doing this, then, besides receiving item hardcoded string,', 'start': 5274.384, 'duration': 4.843}, {'end': 5283.73, 'text': 'then I should receive the name of the class that I initialize from the very beginning.', 'start': 5279.227, 'duration': 4.503}, {'end': 5288.732, 'text': 'So this should be phone, because that is the only single instance that I have right now.', 'start': 5283.79, 'duration': 4.942}, {'end': 5292.134, 'text': "And you can see that this is exactly the result that I'm receiving back.", 'start': 5289.113, 'duration': 3.021}, {'end': 5293.415, 'text': 'So that is perfect.', 'start': 5292.174, 'duration': 1.241}, {'end': 5297.878, 'text': 'Now. I said earlier that by using the super function,', 'start': 5293.715, 'duration': 4.163}, {'end': 5304.282, 'text': 'then we basically have access to all the attributes and the methods that are coming from the class that we inherit from.', 'start': 5297.878, 'duration': 6.404}, {'end': 5311.966, 'text': 'So what that means, it means that we will also have the access to the class attribute of all that is inside the item class.', 'start': 5304.642, 'duration': 7.324}, {'end': 5315.388, 'text': "And I'm talking about the that attribute.", 'start': 5312.547, 'duration': 2.841}, {'end': 5315.948, 'text': 'All right.', 'start': 5315.648, 'duration': 0.3}, {'end': 5321.53, 'text': "Now to show you that, then I'm going to open back the code from the phone class.", 'start': 5316.449, 'duration': 5.081}, {'end': 5324.451, 'text': "And I'm going to remove the old attribute.", 'start': 5322.01, 'duration': 2.441}, {'end': 5326.972, 'text': "And I'm just going to do that right now.", 'start': 5324.971, 'duration': 2.001}, {'end': 5333.114, 'text': "And I'm also going to delete the actions to execute where I use phone dot all dot append,", 'start': 5327.352, 'duration': 5.762}], 'summary': 'Accessing class name using magic attribute, demonstrating inheritance and accessing class attributes.', 'duration': 84.648, 'max_score': 5248.466, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5248466.jpg'}, {'end': 5288.732, 'src': 'embed', 'start': 5257.593, 'weight': 1, 'content': [{'end': 5258.734, 'text': "So I'm going to delete that.", 'start': 5257.593, 'duration': 1.141}, {'end': 5261.256, 'text': "And I'm going to use curly brackets.", 'start': 5259.134, 'duration': 2.122}, {'end': 5265.559, 'text': "And I'm going to say self dot double underscore class.", 'start': 5261.336, 'duration': 4.223}, {'end': 5269.122, 'text': 'dot double underscore name.', 'start': 5266.52, 'duration': 2.602}, {'end': 5273.884, 'text': 'So that is a generic way to access to the name of the class from the instance.', 'start': 5269.442, 'duration': 4.442}, {'end': 5279.227, 'text': 'And by doing this, then, besides receiving item hardcoded string,', 'start': 5274.384, 'duration': 4.843}, {'end': 5283.73, 'text': 'then I should receive the name of the class that I initialize from the very beginning.', 'start': 5279.227, 'duration': 4.503}, {'end': 5288.732, 'text': 'So this should be phone, because that is the only single instance that I have right now.', 'start': 5283.79, 'duration': 4.942}], 'summary': 'Using self.__class__.__name to access class name from instance.', 'duration': 31.139, 'max_score': 5257.593, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5257593.jpg'}, {'end': 5392.629, 'src': 'embed', 'start': 5345.277, 'weight': 0, 'content': [{'end': 5355.28, 'text': 'So that is a great idea removing the old attribute in the child class level, it is a great idea to only use the old attribute in the parent class.', 'start': 5345.277, 'duration': 10.003}, {'end': 5361.107, 'text': 'Because by using the super function in the child class, we will have access to the old attribute.', 'start': 5355.72, 'duration': 5.387}, {'end': 5370.219, 'text': "So this means that if one day we'd like to have access to all the items instances that have been initialized, including the child classes,", 'start': 5361.247, 'duration': 8.972}, {'end': 5374.064, 'text': 'then accessing them from item dot all should also be enough.', 'start': 5370.219, 'duration': 3.845}, {'end': 5382.486, 'text': 'Now you might be confused how this line is responsible to add this instance inside the all attribute that is happened to be a list.', 'start': 5374.304, 'duration': 8.182}, {'end': 5392.629, 'text': "And that's happening because by using the super function, and as well as the init, then we basically call the init method inside the parent class.", 'start': 5382.906, 'duration': 9.723}], 'summary': 'Use super function to access old attribute and initialize instances in the parent class.', 'duration': 47.352, 'max_score': 5345.277, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5345277.jpg'}, {'end': 5458.061, 'src': 'embed', 'start': 5435.508, 'weight': 4, 'content': [{'end': 5445.192, 'text': "So that's why maybe working with a file that will represent the class of item and working with a separate file that will represent the phone child class will be a better idea.", 'start': 5435.508, 'duration': 9.684}, {'end': 5452.376, 'text': 'So we will have the main dot py file dedicated for only creating instances of those classes.', 'start': 5445.292, 'duration': 7.084}, {'end': 5454.177, 'text': "So let's get started with this.", 'start': 5452.856, 'duration': 1.321}, {'end': 5458.061, 'text': "So I'm going to go to the project directory and create two Python files.", 'start': 5454.318, 'duration': 3.743}], 'summary': 'Working with separate files for class and child class can be a better idea. creating instances in main.py.', 'duration': 22.553, 'max_score': 5435.508, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5435508.jpg'}, {'end': 5572.473, 'src': 'heatmap', 'start': 5486.648, 'weight': 0.819, 'content': [{'end': 5489.651, 'text': "So I'm going to just copy the import line.", 'start': 5486.648, 'duration': 3.003}, {'end': 5491.833, 'text': 'And that should be good enough.', 'start': 5490.191, 'duration': 1.642}, {'end': 5496.418, 'text': "Now I'm going to do the same process for the phone.py.", 'start': 5492.313, 'duration': 4.105}, {'end': 5500.843, 'text': "And I'm going to be copying this into the phone.py file as well.", 'start': 5496.618, 'duration': 4.225}, {'end': 5506.77, 'text': 'But now this file needs to import the item class because as you can see, we got an error here.', 'start': 5501.224, 'duration': 5.546}, {'end': 5514.037, 'text': 'So we should say from item, import item like the following and the errors should be gone.', 'start': 5507.211, 'duration': 6.826}, {'end': 5520.581, 'text': 'And then in the main dot py file, we can basically use this file to only instantiate instances,', 'start': 5514.517, 'duration': 6.064}, {'end': 5524.443, 'text': 'meaning creating data that will represent something to Python.', 'start': 5520.581, 'duration': 3.862}, {'end': 5530.607, 'text': 'So this means that we can go ahead and import the class from the item file, we can do the same.', 'start': 5524.924, 'duration': 5.683}, {'end': 5533.769, 'text': 'from the phone file.', 'start': 5531.588, 'duration': 2.181}, {'end': 5537.051, 'text': 'And then we can go ahead and do the stuff that we used to do.', 'start': 5534.229, 'duration': 2.822}, {'end': 5541.093, 'text': 'So we can say item dot instantiate from CSV.', 'start': 5537.131, 'duration': 3.962}, {'end': 5547.876, 'text': 'And to verify that this works, we can also say print item dot all like that.', 'start': 5541.573, 'duration': 6.303}, {'end': 5552.539, 'text': 'And if we want to run this file now to see that this works, then we can do that.', 'start': 5548.557, 'duration': 3.982}, {'end': 5555.06, 'text': 'And you can see that everything works just as expected.', 'start': 5552.619, 'duration': 2.441}, {'end': 5561.565, 'text': "Now just a quick side note, I'm not going to rely too much on the child class that we have created in the latest episode.", 'start': 5555.66, 'duration': 5.905}, {'end': 5564.607, 'text': "To show the problems that we're going to solve in that episode.", 'start': 5561.905, 'duration': 2.702}, {'end': 5572.473, 'text': "I'm going to rely more on the item class so that it will be easier to follow and we will not complex things too much.", 'start': 5564.607, 'duration': 7.866}], 'summary': 'Imported and instantiated classes from files, verified functionality, and avoided overreliance on child class.', 'duration': 85.825, 'max_score': 5486.648, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5486648.jpg'}, {'end': 5541.093, 'src': 'embed', 'start': 5514.517, 'weight': 5, 'content': [{'end': 5520.581, 'text': 'And then in the main dot py file, we can basically use this file to only instantiate instances,', 'start': 5514.517, 'duration': 6.064}, {'end': 5524.443, 'text': 'meaning creating data that will represent something to Python.', 'start': 5520.581, 'duration': 3.862}, {'end': 5530.607, 'text': 'So this means that we can go ahead and import the class from the item file, we can do the same.', 'start': 5524.924, 'duration': 5.683}, {'end': 5533.769, 'text': 'from the phone file.', 'start': 5531.588, 'duration': 2.181}, {'end': 5537.051, 'text': 'And then we can go ahead and do the stuff that we used to do.', 'start': 5534.229, 'duration': 2.822}, {'end': 5541.093, 'text': 'So we can say item dot instantiate from CSV.', 'start': 5537.131, 'duration': 3.962}], 'summary': 'In the main.py file, instances are instantiated from item and phone files, and data is created to represent something in python.', 'duration': 26.576, 'max_score': 5514.517, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5514517.jpg'}], 'start': 5137.81, 'title': 'Object oriented programming best practices and code organization', 'summary': 'Demonstrates best practices of object oriented programming, such as using separated constructors for child classes and accessing class attributes generically, resulting in improved code organization and data handling. additionally, it discusses the benefits of using superclass and subclass attributes, showcasing how to organize code into separate files for better project scalability and demonstrating the instantiation of instances from the files.', 'chapters': [{'end': 5345.217, 'start': 5137.81, 'title': 'Object oriented programming best practices', 'summary': 'Demonstrates best practices of object oriented programming, such as using separated constructors for child classes and accessing class attributes generically, resulting in improved code organization and data handling.', 'duration': 207.407, 'highlights': ['By using the super function, we have access to all attributes and methods from the inherited class, ensuring improved code reusability and maintenance.', "Accessing class attributes generically using special magic attribute '__class__.__name__' allows for improved code organization, leading to clarity and ease of maintenance.", 'Implementing separate constructors for child classes ensures better code organization and behavior consistency, resulting in improved code readability and maintainability.', 'Demonstrated the need to call the super function in order to have full access to all attributes and methods from the inherited class, ensuring proper behavior and functionality.']}, {'end': 5582.601, 'start': 5345.277, 'title': 'Code organization and class inheritance', 'summary': 'Discusses the benefits of using superclass and subclass attributes, showcasing how to organize code into separate files for better project scalability and demonstrating the instantiation of instances from the files.', 'duration': 237.324, 'highlights': ['Using superclass and subclass attributes for better code organization and scalability By utilizing the super function and init method, accessing attributes from the parent class, such as item.all, provides a comprehensive view of initialized instances, enhancing code organization and scalability.', 'Organizing code into separate files for improved project scalability Transitioning from a single file to separate files for item and phone classes allows for better code organization and management, especially as the project grows and requires working with multiple classes.', 'Demonstrating instantiation of instances from separate files Importing classes from item and phone files to instantiate instances and manage data organization showcases a practical approach to working with separate files for class instantiation and data representation.']}], 'duration': 444.791, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5137810.jpg', 'highlights': ['By using the super function, we have access to all attributes and methods from the inherited class, ensuring improved code reusability and maintenance.', "Accessing class attributes generically using special magic attribute '__class__.__name__' allows for improved code organization, leading to clarity and ease of maintenance.", 'Implementing separate constructors for child classes ensures better code organization and behavior consistency, resulting in improved code readability and maintainability.', 'Using superclass and subclass attributes for better code organization and scalability By utilizing the super function and init method, accessing attributes from the parent class, such as item.all, provides a comprehensive view of initialized instances, enhancing code organization and scalability.', 'Organizing code into separate files for improved project scalability Transitioning from a single file to separate files for item and phone classes allows for better code organization and management, especially as the project grows and requires working with multiple classes.', 'Demonstrating instantiation of instances from separate files Importing classes from item and phone files to instantiate instances and manage data organization showcases a practical approach to working with separate files for class instantiation and data representation.']}, {'end': 7954.227, 'segs': [{'end': 6356.558, 'src': 'embed', 'start': 6330.465, 'weight': 0, 'content': [{'end': 6336.086, 'text': 'I can also do that later on if I only use this convention in here.', 'start': 6330.465, 'duration': 5.621}, {'end': 6342.368, 'text': 'Now those gathers and seders thing are always confusing in no matter programming language you work.', 'start': 6336.546, 'duration': 5.822}, {'end': 6346.889, 'text': 'So I will do a final summary of all what we have learned until this point.', 'start': 6342.848, 'duration': 4.041}, {'end': 6356.558, 'text': "Alright, so using add property, will basically give you a control of what you'd like to do when you get an attribute.", 'start': 6347.329, 'duration': 9.229}], 'summary': 'Learning about add property for attribute control.', 'duration': 26.093, 'max_score': 6330.465, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs6330465.jpg'}, {'end': 6535.418, 'src': 'embed', 'start': 6510.863, 'weight': 1, 'content': [{'end': 6517.366, 'text': 'Okay, so if I was to run that, then you can see that at first we see the line of you are trying to set,', 'start': 6510.863, 'duration': 6.503}, {'end': 6522.228, 'text': 'then right after it we actually see whatever item one dot name is equal to.', 'start': 6517.366, 'duration': 4.862}, {'end': 6527.972, 'text': 'Now the reason that the value is set, it is because we set it over here.', 'start': 6522.808, 'duration': 5.164}, {'end': 6532.536, 'text': 'And then the next time I try to get the value, then those lines are getting executed.', 'start': 6528.072, 'duration': 4.464}, {'end': 6535.418, 'text': 'So that is the lifecycle of getters and setters.', 'start': 6532.596, 'duration': 2.822}], 'summary': 'Explanation of the lifecycle of getters and setters.', 'duration': 24.555, 'max_score': 6510.863, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs6510863.jpg'}, {'end': 7072.265, 'src': 'embed', 'start': 7041.585, 'weight': 3, 'content': [{'end': 7048.27, 'text': 'And if I was to run that, then you can see that the price has been incremented to 900 as expected.', 'start': 7041.585, 'duration': 6.685}, {'end': 7057.416, 'text': "So that is exactly encapsulation in action, because you go ahead and you don't allow the access directly to the price attribute.", 'start': 7048.77, 'duration': 8.646}, {'end': 7064.64, 'text': 'Besides you modify this attribute by using methods like apply increment or apply discount.', 'start': 7057.856, 'duration': 6.784}, {'end': 7072.265, 'text': 'Now the same will happen if I was to now go ahead and use item one dot apply discount.', 'start': 7064.981, 'duration': 7.284}], 'summary': 'Encapsulation in action: price incremented to 900 as expected, using methods like apply increment or apply discount.', 'duration': 30.68, 'max_score': 7041.585, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs7041585.jpg'}, {'end': 7456.654, 'src': 'embed', 'start': 7427.228, 'weight': 2, 'content': [{'end': 7431.39, 'text': 'Okay, so inheritance is the third principle of object oriented programming.', 'start': 7427.228, 'duration': 4.162}, {'end': 7437.292, 'text': 'inheritance is a mechanism that allows us to reuse code across our classes.', 'start': 7431.85, 'duration': 5.442}, {'end': 7442.275, 'text': "Now that's something that we have totally designed well throughout this course,", 'start': 7437.693, 'duration': 4.582}, {'end': 7451.479, 'text': 'because we came up with more classes that are child classes of the item class, where each child class represents a kind of an item.', 'start': 7442.275, 'duration': 9.204}, {'end': 7456.654, 'text': 'Now pay attention how I changed the import line from phone.', 'start': 7452.352, 'duration': 4.302}], 'summary': 'Inheritance is the third principle of object oriented programming, allowing code reuse across classes.', 'duration': 29.426, 'max_score': 7427.228, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs7427228.jpg'}], 'start': 5583.081, 'title': 'Read-only attributes in python', 'summary': 'Covers the concept of read-only attributes in object-oriented programming, explaining their implementation in python using the property decorator and underscores. it also explores the principles of encapsulation, getters, setters, and managing attributes, emphasizing their significance in effective attribute management and large program design.', 'chapters': [{'end': 5719.371, 'start': 5583.081, 'title': 'Read only attributes in object-oriented programming', 'summary': "Explains the concept of read-only attributes in object-oriented programming, showcasing an example of creating a read-only attribute for the 'name' of an item instance using a property decorator, emphasizing the principles of encapsulation.", 'duration': 136.29, 'highlights': ['The chapter explains the concept of read-only attributes in object-oriented programming It discusses the concept of read-only attributes and their importance in object-oriented programming.', "Creating a read-only attribute for the 'name' of an item instance using a property decorator The chapter demonstrates the process of creating a read-only attribute for the 'name' of an item instance using a property decorator, showcasing the implementation of encapsulation.", 'Emphasizing the principles of encapsulation It emphasizes the importance of encapsulation in object-oriented programming and its role in creating read-only attributes to restrict the modification of certain attributes after initialization.']}, {'end': 6304.467, 'start': 5719.931, 'title': 'Python: creating read-only attributes', 'summary': 'Explains how to create read-only attributes in python using the property decorator and underscores, demonstrating the limitations and ways to set a new value for the read-only attribute.', 'duration': 584.536, 'highlights': ['Using property decorator to create a read-only attribute The transcript explains the use of the property decorator to create a read-only attribute by returning a value and preventing the attribute from being set, demonstrating the restriction through an example.', 'Utilizing single underscore to indicate read-only attribute It details the use of a single underscore before the attribute name and in the property function to indicate the read-only attribute, preventing direct access to the attribute and demonstrating accessing the attribute using the underscore.', 'Preventing access to attributes outside the class using double underscore The transcript explains the use of double underscore before the attribute name to prevent access to the attribute outside the class, similar to a private attribute in other programming languages, and demonstrates the restriction by attempting to access the attribute from outside the class.', 'Allowing to set a new value for the read-only attribute using a special decorator It introduces the use of a special decorator, the setter method, to allow setting a new value for the read-only attribute, demonstrating the use of the setter method and defining a method to set the new value for the read-only attribute.']}, {'end': 6610.607, 'start': 6305.028, 'title': 'Python getters and setters', 'summary': 'Explains the concept of getters and setters in python, demonstrating how to control attribute access and modify attribute values, and emphasizes the importance of understanding and utilizing this feature for effective attribute management.', 'duration': 305.579, 'highlights': ["By using add property, you can control attribute access and convert attributes into read-only if setters are not implemented, ensuring effective attribute management. The 'add property' feature enables control of attribute access and conversion of attributes into read-only, ensuring effective attribute management.", 'The ability to set attributes allows for defining conditions and raising exceptions, such as restricting the length of characters for attribute names, providing enhanced attribute value management. The capability to set attributes allows for defining conditions and raising exceptions, enhancing attribute value management.', 'The lifecycle of getters and setters allows for controlling attribute access and modifying attribute values, ensuring effective attribute management. Understanding the lifecycle of getters and setters enables effective control and modification of attribute values.']}, {'end': 7403.651, 'start': 6611.107, 'title': 'Managing attributes and object-oriented programming principles', 'summary': 'Covers managing attributes in object-oriented programming, including encapsulation and abstraction principles, demonstrating their implementation in python and discussing their importance in designing large programs.', 'duration': 792.544, 'highlights': ['The chapter emphasizes the importance of managing attributes and provides the necessary tools to do so in object-oriented programming. The speaker encourages the audience to play around with different attributes and manage them successfully, offering the necessary knowledge to design rich classes with multiple attributes.', 'Encapsulation principle is explained in detail, showcasing its implementation through methods like apply increment and apply discount to restrict direct access to attributes. The concept of encapsulation is exemplified through the restriction of direct access to attributes, demonstrated through the application of methods like apply increment and apply discount to modify the attribute values.', 'The implementation of abstraction principle is demonstrated, emphasizing the concept of hiding unnecessary information from the instances. The concept of abstraction is illustrated through the creation of private methods to hide unnecessary details from instances, simulating the process of sending an email in the context of object-oriented programming.']}, {'end': 7954.227, 'start': 7404.571, 'title': 'Object oriented programming principles', 'summary': 'Discusses the principles of object-oriented programming, including abstraction, inheritance, and polymorphism, illustrating their application in python programming. it highlights the reuse of code, handling different types of objects, and the use of single entity to represent different types, emphasizing the practical implications of these principles in programming.', 'duration': 549.656, 'highlights': ['Inheritance allows us to reuse code across classes, demonstrated through child classes representing different kinds of items in Python programming. Inheritance is a mechanism that enables the reuse of code across classes, illustrated by the creation of child classes representing different kinds of items in Python programming.', 'Polymorphism refers to using a single type entity to represent different types in different scenarios, such as handling different kinds of objects in Python programming. Polymorphism involves using a single type entity to represent different types in different scenarios, as demonstrated by handling different kinds of objects in Python programming.', 'Abstraction involves abstracting unnecessary information from instances, allowing accessibility outside of the class. Abstraction entails abstracting unnecessary information from instances to allow accessibility outside of the class.']}], 'duration': 2371.146, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ej_02ICOIgs/pics/Ej_02ICOIgs5583081.jpg', 'highlights': ["The 'add property' feature enables control of attribute access and conversion of attributes into read-only, ensuring effective attribute management.", 'Understanding the lifecycle of getters and setters enables effective control and modification of attribute values.', 'Inheritance is a mechanism that enables the reuse of code across classes, illustrated by the creation of child classes representing different kinds of items in Python programming.', 'The concept of encapsulation is exemplified through the restriction of direct access to attributes, demonstrated through the application of methods like apply increment and apply discount to modify the attribute values.']}], 'highlights': ['Understanding object-oriented programming is crucial for software developers, as it can be the key to becoming a great Python developer and landing the first job as a software engineer.', 'JimShapeCoding provides a course on Python object-oriented programming to help developers improve their skills and job prospects.', 'The chapter emphasizes the importance of developing a real Python application to understand complex object-oriented programming concepts.', 'The chapter highlights the relevance of writing object-oriented programs through the example of a store management system.', 'Practical example of calculating the total price of items using methods in Python. Demonstrates a practical example of creating a method to calculate the total price of items based on their attributes in Python.', 'Creating classes, instances, attributes, and methods in Python. Illustrates the process of creating classes, instances, and defining attributes and methods within the class structure.', 'The chapter explains the concept of object-oriented programming using Python. Covers the basics of object-oriented programming and its implementation in Python.', 'The chapter explains the concept of classes and constructors, including the use of attribute assignments, parameter passing, data typing, and validation using assert statements.', 'The chapter demonstrates using the double underscore init method to dynamically assign attributes to Python instances, allowing for unique attribute assignment for each instance.', 'The chapter emphasizes the ability to assign attributes to specific instances individually, providing the flexibility to assign unique attributes to specific instances.', 'The chapter showcases differentiating between mandatory and non-mandatory parameters, enabling default values for certain attributes such as quantity, demonstrating realistic scenarios and flexibility in attribute assignment.', 'The importance of understanding behavior related to object passing and parameter receiving in classes is emphasized.', 'The chapter explains the concept of class attributes and how they can be accessed from both the class and instance levels, providing clarity on their usage.', 'Instances in Python first attempt to retrieve attributes from the instance level, and if not found, they search for them at the class level, which clarifies the behavior of attribute access.', "A built-in magic attribute, '__dict__', allows users to view all the attributes belonging to a specific object, providing a way to inspect the object's content.", 'The chapter explores the usage of magic attributes and method creation within a class, emphasizing the importance of accessing class attributes at the instance level when creating methods.', "The method 'apply discount' is demonstrated to override the price attribute for instances, with examples of assigning different discount amounts to specific items using instance attributes.", 'The significance of accessing class attributes at the instance level is highlighted, with the recommendation to access them from the instance level while creating methods.', "Creating a list 'all' to store class instances The chapter introduces the concept of creating a class attribute 'all' to store instances, streamlining access and management of all created instances.", 'Customizing Object Representation with __repr__ Method The chapter explains the use of the __repr__ method to customize the representation of objects by returning a unique string for each instance, allowing for easy identification and immediate instance creation in Python console.', "Appending instances to the 'all' list The process of appending instances to the 'all' list within the '__init__' method is detailed, demonstrating how the list is dynamically populated with each new instance created.", 'Benefits of Using CSV for Data Maintenance Demonstrates the advantages of using a CSV file to store and manage structured data, highlighting its capability to represent data in a table format, making it easier to visualize and maintain the data.', "Utilizing the list for operations on instances The chapter showcases the practical utility of the 'all' list, such as accessing specific attributes of instances through a loop, and highlights its usefulness for targeted operations on instances.", 'Utilizing the CSV library to read and instantiate objects from a CSV file', 'Conversion of a method into a class method using a decorator', 'Handling data type conversion issues to ensure successful instantiation', 'Static methods have a logical connection to a class, such as checking if a number is an integer or a float', 'Static methods are similar to class methods but do not send the object as the first argument', 'Utilizing if statements and the is_integer function to check if a number is an integer', "Inheritance allows the creation of child classes like 'phone' inheriting from the parent class 'item', providing a way to represent different kinds of objects with shared attributes and methods.", 'The super function allows full access to all attributes of the parent class, avoiding the need for hard coding attribute assignments, which would lead to a lot of code duplication.', 'The challenge of creating a constructor for a child class while maintaining the logic of the parent class is discussed, emphasizing the need to pass additional attributes during instance creation.', 'The main difference between a class method and a static method is that static methods are used for non-unique tasks, while class methods are used for instantiating instances from structured data.', 'By using the super function, we have access to all attributes and methods from the inherited class, ensuring improved code reusability and maintenance.', "Accessing class attributes generically using special magic attribute '__class__.__name__' allows for improved code organization, leading to clarity and ease of maintenance.", 'Implementing separate constructors for child classes ensures better code organization and behavior consistency, resulting in improved code readability and maintainability.', 'Using superclass and subclass attributes for better code organization and scalability By utilizing the super function and init method, accessing attributes from the parent class, such as item.all, provides a comprehensive view of initialized instances, enhancing code organization and scalability.', 'Organizing code into separate files for improved project scalability Transitioning from a single file to separate files for item and phone classes allows for better code organization and management, especially as the project grows and requires working with multiple classes.', 'Demonstrating instantiation of instances from separate files Importing classes from item and phone files to instantiate instances and manage data organization showcases a practical approach to working with separate files for class instantiation and data representation.', "The 'add property' feature enables control of attribute access and conversion of attributes into read-only, ensuring effective attribute management.", 'Understanding the lifecycle of getters and setters enables effective control and modification of attribute values.', 'Inheritance is a mechanism that enables the reuse of code across classes, illustrated by the creation of child classes representing different kinds of items in Python programming.', 'The concept of encapsulation is exemplified through the restriction of direct access to attributes, demonstrated through the application of methods like apply increment and apply discount to modify the attribute values.']}