title
Intermediate Python Programming Course

description
Take your Python skills to the next level with this intermediate Python course. First, you will get a review of basic concepts such as lists, strings, and dictionaries, but with an emphasis on some lesser known capabilities. Then, you will learn more advanced topics such as threading, multiprocessing, context managers, generators, and more. 💻 Code: https://github.com/python-engineer/python-engineer-notebooks/tree/master/advanced-python 🎥 Course from Patrick Loeber. Check out his channel: https://www.youtube.com/channel/UCbXgNpp0jedKWcQiULLbDTA 🔗 Written Tutorials from Patrick: https://www.python-engineer.com/courses/advancedpython/ ⭐️ Course Contents ⭐️ ⌨️ (0:00:00) Intro ⌨️ (0:00:56) Lists ⌨️ (0:16:30) Tuples ⌨️ (0:29:49) Dictionaries ⌨️ (0:42:40) Sets ⌨️ (0:58:44) Strings ⌨️ (1:22:50) Collections ⌨️ (1:36:43) Itertools ⌨️ (1:51:50) Lambda Functions ⌨️ (2:04:03) Exceptions and Errors ⌨️ (2:20:10) Logging ⌨️ (2:42:20) JSON ⌨️ (2:59:42) Random Numbers ⌨️ (3:14:23) Decorators ⌨️ (3:35:32) Generators ⌨️ (3:53:29) Threading vs Multiprocessing ⌨️ (4:07:59) Multithreading ⌨️ (4:31:05) Multiprocessing ⌨️ (4:53:26) Function Arguments ⌨️ (5:17:28) The Asterisk (*) Operator ⌨️ (5:30:19) Shallow vs Deep Copying ⌨️ (5:40:07) Context Managers -- 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': 'Intermediate Python Programming Course', 'heatmap': [{'end': 3422.53, 'start': 3201.847, 'weight': 0.722}, {'end': 18793.687, 'start': 18576.306, 'weight': 1}], 'summary': 'This python course by patrick for intermediate skill level covers advanced topics, python lists, tuples, dictionaries, sets, strings, iterators, functions, exceptions, logging, json, random module, decorators, generators, threading, multiprocessing, and function arguments with a total of 14 chapters, providing practical examples and emphasizing efficiency comparisons in python.', 'chapters': [{'end': 1769.326, 'segs': [{'end': 118.924, 'src': 'embed', 'start': 75.798, 'weight': 0, 'content': [{'end': 80.58, 'text': 'And within these brackets, you put each element that you want separated by a comma.', 'start': 75.798, 'duration': 4.782}, {'end': 93.184, 'text': "For example, let's put some strings in here, banana, cherry, and an apple.", 'start': 81.52, 'duration': 11.664}, {'end': 100.601, 'text': 'And if we print this, then we see that all elements are printed.', 'start': 93.824, 'duration': 6.777}, {'end': 107.062, 'text': 'Now you can also create a new empty list with the list function.', 'start': 100.621, 'duration': 6.441}, {'end': 110.803, 'text': 'So my list two equals list.', 'start': 107.982, 'duration': 2.821}, {'end': 118.924, 'text': 'And if we print this, then we see that this creates an empty list.', 'start': 111.803, 'duration': 7.121}], 'summary': 'Demonstrating how to create and manipulate lists in python, including separating elements and creating an empty list.', 'duration': 43.126, 'max_score': 75.798, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo75798.jpg'}, {'end': 192.626, 'src': 'embed', 'start': 156.772, 'weight': 10, 'content': [{'end': 161.214, 'text': 'Now if you want to access an element, you do that by referring to the index.', 'start': 156.772, 'duration': 4.442}, {'end': 165.957, 'text': "So let's say item equals my list.", 'start': 162.315, 'duration': 3.642}, {'end': 169.899, 'text': 'And then inside brackets, you specify the index.', 'start': 166.417, 'duration': 3.482}, {'end': 173.921, 'text': 'And note that the indices start at zero.', 'start': 170.859, 'duration': 3.062}, {'end': 180.384, 'text': 'So index zero is the first, the very first item, in this case the banana.', 'start': 174.481, 'duration': 5.903}, {'end': 190.284, 'text': 'if we print the item, then we see this is the banana and index number one is the cherry.', 'start': 180.384, 'duration': 9.9}, {'end': 192.626, 'text': 'index number two is the apple.', 'start': 190.284, 'duration': 2.342}], 'summary': 'Access elements in a list using indices, starting from zero. for example, item at index 0 is banana, index 1 is cherry, and index 2 is apple.', 'duration': 35.854, 'max_score': 156.772, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo156772.jpg'}, {'end': 296.246, 'src': 'embed', 'start': 256.762, 'weight': 4, 'content': [{'end': 263.264, 'text': 'Now if you want to check if an item is inside our your list, you can do that with an if.', 'start': 256.762, 'duration': 6.502}, {'end': 275.231, 'text': "And then your item that you want to check, say banana in my list, colon and say, let's print.", 'start': 264.745, 'duration': 10.486}, {'end': 279.734, 'text': 'Yes, and else.', 'start': 276.993, 'duration': 2.741}, {'end': 283.557, 'text': 'Print No.', 'start': 281.876, 'duration': 1.681}, {'end': 289.88, 'text': 'Now if you run this, then we see that the banana is inside our list.', 'start': 284.875, 'duration': 5.005}, {'end': 296.246, 'text': "So let's check if the lemon is no, the apple.", 'start': 290, 'duration': 6.246}], 'summary': 'Using conditional statements to check for items in a list, banana is present, lemon and apple are not.', 'duration': 39.484, 'max_score': 256.762, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo256762.jpg'}, {'end': 439.692, 'src': 'embed', 'start': 397.937, 'weight': 7, 'content': [{'end': 409.199, 'text': 'So if we assign this to a variable, and print it, and we see that now we got our apple back.', 'start': 397.937, 'duration': 11.262}, {'end': 419.122, 'text': 'And if we print our list, then we see that the apple is no longer in our list.', 'start': 409.76, 'duration': 9.362}, {'end': 431.725, 'text': 'Now we can also remove a specific element with the dot remove method.', 'start': 420.936, 'duration': 10.789}, {'end': 439.692, 'text': "For example, let's remove the cherry, then we see that the cherry got removed.", 'start': 431.805, 'duration': 7.887}], 'summary': 'Using python, a variable assigned and printed, showing apple retrieval and cherry removal.', 'duration': 41.755, 'max_score': 397.937, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo397937.jpg'}, {'end': 1028.098, 'src': 'embed', 'start': 998.516, 'weight': 13, 'content': [{'end': 1003.558, 'text': 'it is similar to a list with the main difference to the tuple cannot be changed after its creation.', 'start': 998.516, 'duration': 5.042}, {'end': 1007.959, 'text': 'A tuple is often used for objects that belong together.', 'start': 1004.838, 'duration': 3.121}, {'end': 1012.541, 'text': "And yeah, let's have a closer look at tuples and what you can do with them.", 'start': 1009.08, 'duration': 3.461}, {'end': 1016.982, 'text': 'First of all, a tuple is created with parentheses.', 'start': 1013.261, 'duration': 3.721}, {'end': 1023.004, 'text': 'And within these parentheses, you put each element that you want separated by a comma.', 'start': 1017.823, 'duration': 5.181}, {'end': 1028.098, 'text': "So for example, let's put in max 28.", 'start': 1023.145, 'duration': 4.953}], 'summary': 'Tuples are immutable lists used for related objects, created with parentheses and elements separated by commas.', 'duration': 29.582, 'max_score': 998.516, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo998516.jpg'}, {'end': 1099.897, 'src': 'embed', 'start': 1060.879, 'weight': 11, 'content': [{'end': 1068.304, 'text': 'So if we have a look at the type of this, then this is recognized as a string.', 'start': 1060.879, 'duration': 7.425}, {'end': 1074.268, 'text': 'So what you have to do, then you have to put a comma at the end, even if it may look strange.', 'start': 1068.884, 'duration': 5.384}, {'end': 1077.05, 'text': "That's the right syntax.", 'start': 1075.969, 'duration': 1.081}, {'end': 1080.472, 'text': "So now it's recognized as a tuple.", 'start': 1077.65, 'duration': 2.822}, {'end': 1093.335, 'text': 'you can also use the built in tuple function to create a tuple from an iterable, for example from a list.', 'start': 1082.25, 'duration': 11.085}, {'end': 1099.897, 'text': 'So say max 28 Boston.', 'start': 1093.795, 'duration': 6.102}], 'summary': 'The transcript discusses string and tuple types, emphasizing syntax and functionality.', 'duration': 39.018, 'max_score': 1060.879, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1060879.jpg'}, {'end': 1250.124, 'src': 'embed', 'start': 1211.351, 'weight': 1, 'content': [{'end': 1214.832, 'text': 'So then for each element, we print it.', 'start': 1211.351, 'duration': 3.481}, {'end': 1221.213, 'text': "And we don't have to call this I can also call it for example, x or whatever we want.", 'start': 1214.852, 'duration': 6.361}, {'end': 1240.048, 'text': 'And we can also easily check if an element is inside our tuple with an if in statement, so if max in my tuple, and then we say just print, yes.', 'start': 1223.064, 'duration': 16.984}, {'end': 1243.289, 'text': 'And otherwise, we print no.', 'start': 1241.408, 'duration': 1.881}, {'end': 1248.384, 'text': 'And if we run this, then we get the yes.', 'start': 1246.383, 'duration': 2.001}, {'end': 1250.124, 'text': 'So Max is in our tuple.', 'start': 1248.424, 'duration': 1.7}], 'summary': "Printing elements and checking for presence in tuple; demonstrated with 'max' in tuple.", 'duration': 38.773, 'max_score': 1211.351, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1211351.jpg'}, {'end': 1318.733, 'src': 'embed', 'start': 1278.964, 'weight': 8, 'content': [{'end': 1291.712, 'text': 'And first of all, if we want to get the number of elements inside our tuple, we can just use the length method to length of my tuple.', 'start': 1278.964, 'duration': 12.748}, {'end': 1295.823, 'text': 'And this returns five, so we have five elements.', 'start': 1292.682, 'duration': 3.141}, {'end': 1313.27, 'text': 'If we want to count some elements inside our tuple, so we can use my tuple dot count, and then we count the letter P.', 'start': 1298.805, 'duration': 14.465}, {'end': 1318.733, 'text': "So then we see we have two letter P's inside our tuple.", 'start': 1313.27, 'duration': 5.463}], 'summary': 'A tuple contains 5 elements, with 2 occurrences of the letter p.', 'duration': 39.769, 'max_score': 1278.964, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1278964.jpg'}, {'end': 1480.747, 'src': 'embed', 'start': 1436.261, 'weight': 3, 'content': [{'end': 1443.806, 'text': "So for example, let's create a tuple with some numbers in it.", 'start': 1436.261, 'duration': 7.545}, {'end': 1453.396, 'text': "And let's create a tuple And then the syntax is, we use the tuple, the original tuple.", 'start': 1444.327, 'duration': 9.069}, {'end': 1458.421, 'text': 'And then inside brackets, we specify a start and a stop index.', 'start': 1453.536, 'duration': 4.885}, {'end': 1462.966, 'text': 'So for example, two to five.', 'start': 1458.481, 'duration': 4.485}, {'end': 1471.323, 'text': 'And if we print this, then we have number 345.', 'start': 1464.548, 'duration': 6.775}, {'end': 1480.747, 'text': 'So this goes from index number two, to index number five, and the about the last index is not included.', 'start': 1471.323, 'duration': 9.424}], 'summary': 'Creating a tuple with numbers, selecting specific indices, e.g., 345.', 'duration': 44.486, 'max_score': 1436.261, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1436261.jpg'}, {'end': 1769.326, 'src': 'embed', 'start': 1739.191, 'weight': 2, 'content': [{'end': 1743.973, 'text': "So there's a very nice method in the time it module time it dot time it.", 'start': 1739.191, 'duration': 4.782}, {'end': 1753.517, 'text': 'And then you can use a statement and repeat this specific number of times.', 'start': 1744.533, 'duration': 8.984}, {'end': 1766.104, 'text': "So in this case, it's 1 million times 1 million times we want to create a a list and 1 million times we want to create a tuple.", 'start': 1753.598, 'duration': 12.506}, {'end': 1769.326, 'text': 'And then measure the time.', 'start': 1767.184, 'duration': 2.142}], 'summary': 'The timeit module is used to measure the time taken to create a list and a tuple 1 million times.', 'duration': 30.135, 'max_score': 1739.191, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1739191.jpg'}], 'start': 0.269, 'title': 'Python advanced course', 'summary': 'Introduces an advanced python course by patrick for intermediate skill level, covering advanced topics, with a focus on helpful tips and in-depth exploration. it also covers python lists, including basic operations and methods, with a total of 21 sections and various examples. additionally, it discusses list copying techniques, list comprehension, tuples creation, and operations, emphasizing efficiency comparison with lists in python.', 'chapters': [{'end': 45.202, 'start': 0.269, 'title': 'Advanced python course', 'summary': 'Introduces an advanced python course by patrick, aimed at intermediate skill level, covering advanced topics to enhance python skills, with a focus on providing helpful tips and in-depth exploration of different topics.', 'duration': 44.933, 'highlights': ['The course is aimed at an intermediate skill level, providing advanced topics to enhance Python skills.', 'Patrick, the instructor, shares helpful tips along the way and goes into detail on various topics.', 'The tutorial is suitable for those who have completed a beginner course and are looking for the next step.']}, {'end': 762.091, 'start': 46.062, 'title': 'Python lists: basic operations and methods', 'summary': 'Covers the essential concepts of python lists, including creation, indexing, iteration, methods like append, insert, pop, remove, clear, reverse, sort, slicing, and copying, and provides examples and explanations for each, with a total of 21 sections and various examples and explanations.', 'duration': 716.029, 'highlights': ['The chapter covers the essential concepts of Python lists, including creation, indexing, iteration, methods like append, insert, pop, remove, clear, reverse, sort, slicing, and copying. This chapter covers the fundamental concepts of Python lists, including creation, indexing, iteration, methods like append, insert, pop, remove, clear, reverse, sort, slicing, and copying.', 'A list is a collection data type that is ordered, mutable, and it allows duplicate elements. Lists in Python are ordered, mutable, and allow duplicate elements.', 'The course is split into 21 sections, and in my opinion, every experienced Python programmer should know about these topics. The course comprises 21 sections, and the speaker believes that every experienced Python programmer should be familiar with these topics.', 'The length method can be used to check the number of elements in a list. The length method can be used to determine the number of elements in a list.', 'The sort method sorts the list in ascending order. The sort method arranges the list in ascending order.']}, {'end': 1175.812, 'start': 763.152, 'title': 'Lists and tuples: copying and comprehension', 'summary': 'Covers list copying techniques, including assignment, dot copy method, list function, and slicing, emphasizing the importance of creating actual copies; it also introduces list comprehension and details tuples creation, access, and immutability.', 'duration': 412.66, 'highlights': ['The chapter covers list copying techniques, emphasizing the importance of creating actual copies using different methods such as assignment, dot copy method, list function, and slicing. It explains the consequences of modifying the copy affecting the original list and demonstrates the importance of creating actual copies using methods like assignment, dot copy method, list function, and slicing.', 'List comprehension is introduced as an elegant and fast way to create a new list from an existing list with one line of code. The chapter introduces list comprehension as an elegant and fast way to create a new list from an existing list with one line of code, demonstrating a practical example of creating a list with squared numbers.', 'The chapter details the creation, access, and immutability of tuples, emphasizing their ordered and immutable nature, and explains the syntax and built-in functions for tuple creation and element access. It details the creation, access, and immutability of tuples, emphasizing their ordered and immutable nature, and explains the syntax and built-in functions for tuple creation and element access, including the use of negative indices and the consequences of attempting to change elements inside a tuple.']}, {'end': 1769.326, 'start': 1175.812, 'title': 'Working with tuples in python', 'summary': 'Discusses various operations on tuples, including iteration, checking for elements, using useful methods like count and index, converting to list and vice versa, slicing, unpacking, and efficiency comparison with lists in python.', 'duration': 593.514, 'highlights': ['Tuples are immutable, and iterating over a tuple is demonstrated using the for-in loop. The chapter explains that tuples are immutable and demonstrates iterating over a tuple using the for-in loop.', 'Methods like count, index, and length are used to perform operations like counting elements, finding the index of specific elements, and determining the number of elements in a tuple. The chapter showcases the usage of methods like count, index, and length to perform operations such as counting elements, finding the index of specific elements, and determining the number of elements in a tuple.', 'Converting a tuple to a list and vice versa is demonstrated using the list and tuple functions. The chapter demonstrates the process of converting a tuple to a list and vice versa using the list and tuple functions.', 'Slicing is illustrated as a way to access sub-parts of a tuple with the use of the colon and optional step argument. The chapter illustrates slicing as a method to access sub-parts of a tuple using the colon and optional step argument.', 'Unpacking of tuples is shown, including unpacking multiple elements with a star and handling mismatched elements. The chapter demonstrates the unpacking of tuples, including unpacking multiple elements with a star and handling mismatched elements.', 'Efficiency comparison between tuples and lists is discussed, highlighting the internal optimizations and efficiency advantages of tuples, especially when working with large data. The chapter discusses the efficiency comparison between tuples and lists, highlighting the internal optimizations and efficiency advantages of tuples, especially when working with large data.']}], 'duration': 1769.057, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo269.jpg', 'highlights': ['The course is aimed at an intermediate skill level, providing advanced topics to enhance Python skills.', 'Patrick, the instructor, shares helpful tips along the way and goes into detail on various topics.', 'The tutorial is suitable for those who have completed a beginner course and are looking for the next step.', 'The chapter covers the essential concepts of Python lists, including creation, indexing, iteration, methods like append, insert, pop, remove, clear, reverse, sort, slicing, and copying.', 'A list is a collection data type that is ordered, mutable, and it allows duplicate elements.', 'The course is split into 21 sections, and in my opinion, every experienced Python programmer should know about these topics.', 'The length method can be used to check the number of elements in a list.', 'The sort method sorts the list in ascending order.', 'The chapter covers list copying techniques, emphasizing the importance of creating actual copies using different methods such as assignment, dot copy method, list function, and slicing.', 'List comprehension is introduced as an elegant and fast way to create a new list from an existing list with one line of code.', 'The chapter details the creation, access, and immutability of tuples, emphasizing their ordered and immutable nature, and explains the syntax and built-in functions for tuple creation and element access.', 'Tuples are immutable, and iterating over a tuple is demonstrated using the for-in loop.', 'Methods like count, index, and length are used to perform operations like counting elements, finding the index of specific elements, and determining the number of elements in a tuple.', 'Converting a tuple to a list and vice versa is demonstrated using the list and tuple functions.', 'Slicing is illustrated as a way to access sub-parts of a tuple with the use of the colon and optional step argument.', 'Unpacking of tuples is shown, including unpacking multiple elements with a star and handling mismatched elements.', 'Efficiency comparison between tuples and lists is discussed, highlighting the internal optimizations and efficiency advantages of tuples, especially when working with large data.']}, {'end': 3523.403, 'segs': [{'end': 1952.142, 'src': 'embed', 'start': 1919.207, 'weight': 4, 'content': [{'end': 1931.374, 'text': 'And what will happen if we use a key that is not inside our dictionary for example, check the last name then this will raise an exception,', 'start': 1919.207, 'duration': 12.167}, {'end': 1932.275, 'text': 'a key error.', 'start': 1931.374, 'duration': 0.901}, {'end': 1933.916, 'text': 'So be careful here.', 'start': 1932.615, 'duration': 1.301}, {'end': 1937.136, 'text': 'A dictionary is mutable.', 'start': 1935.495, 'duration': 1.641}, {'end': 1941.157, 'text': 'So you can add or change items after its creation.', 'start': 1937.236, 'duration': 3.921}, {'end': 1952.142, 'text': 'So when we want to add a key value pair, we simply do it like so we say my dict and then inside brackets, give it the new key.', 'start': 1941.798, 'duration': 10.344}], 'summary': 'Using a key not in dictionary raises a keyerror. dictionaries are mutable and allow adding or changing items.', 'duration': 32.935, 'max_score': 1919.207, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1919207.jpg'}, {'end': 3096.361, 'src': 'embed', 'start': 3050.179, 'weight': 1, 'content': [{'end': 3056.162, 'text': 'Now union and intersection and the difference method that I just showed you.', 'start': 3050.179, 'duration': 5.983}, {'end': 3060.304, 'text': 'they will not modify the original sets.', 'start': 3056.162, 'duration': 4.142}, {'end': 3064.246, 'text': 'they always will return a new set.', 'start': 3060.304, 'duration': 3.942}, {'end': 3068.549, 'text': 'But we can also modify our sets in place.', 'start': 3064.967, 'duration': 3.582}, {'end': 3087.514, 'text': 'So, for example, we can say set a dot, update set B And now print our set a.', 'start': 3069.449, 'duration': 18.065}, {'end': 3096.361, 'text': 'then we will see that this updates the set by adding the elements that are found in another set.', 'start': 3087.514, 'duration': 8.847}], 'summary': 'Sets in python can be modified in place using update method, adding elements from another set.', 'duration': 46.182, 'max_score': 3050.179, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo3050179.jpg'}, {'end': 3329.037, 'src': 'embed', 'start': 3293.095, 'weight': 3, 'content': [{'end': 3307.759, 'text': 'And in this case it returns false, because a super set returns true if the first set contains all the numbers or all the elements from the second set.', 'start': 3293.095, 'duration': 14.664}, {'end': 3313.942, 'text': 'So set B does not contain 546.', 'start': 3308.82, 'duration': 5.122}, {'end': 3315.284, 'text': "So it's not a superset.", 'start': 3313.942, 'duration': 1.342}, {'end': 3322.877, 'text': 'But set A is a superset of set B, because it contains one, two, and three.', 'start': 3315.865, 'duration': 7.012}, {'end': 3329.037, 'text': 'And we can calculate if two sets are disjoint.', 'start': 3325.234, 'duration': 3.803}], 'summary': 'Set a is a superset of set b, containing 1, 2, and 3.', 'duration': 35.942, 'max_score': 3293.095, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo3293095.jpg'}, {'end': 3444.368, 'src': 'heatmap', 'start': 3201.847, 'weight': 0, 'content': [{'end': 3205.911, 'text': 'So one, two, and three are found in both sets.', 'start': 3201.847, 'duration': 4.064}, {'end': 3212.817, 'text': 'So these are not taken, but then it takes all the remaining elements from both sets.', 'start': 3206.431, 'duration': 6.386}, {'end': 3220.173, 'text': 'Yeah, you have probably have to play around with them yourselves a little bit to make it clearer.', 'start': 3214.909, 'duration': 5.264}, {'end': 3227.319, 'text': "And yeah, let's also talk about subset superset and disjoint methods.", 'start': 3221.294, 'duration': 6.025}, {'end': 3235.765, 'text': "So for example, let's make them a little bit smaller.", 'start': 3228.239, 'duration': 7.526}, {'end': 3249.531, 'text': 'You can calculate the if set a is a subset of set B.', 'start': 3239.148, 'duration': 10.383}, {'end': 3257.383, 'text': 'And if we print this, then this will return false.', 'start': 3249.531, 'duration': 7.852}, {'end': 3269.116, 'text': 'because subset means that all the elements of our first set are also in our second set.', 'start': 3258.291, 'duration': 10.825}, {'end': 3283.543, 'text': 'So if we use it the other way around, set B is a subset of set A, then this will return true, because one, two, and three are also in the second set.', 'start': 3269.756, 'duration': 13.787}, {'end': 3287.873, 'text': 'And the opposite is called the super set method.', 'start': 3284.992, 'duration': 2.881}, {'end': 3290.814, 'text': 'So is super set.', 'start': 3288.473, 'duration': 2.341}, {'end': 3307.759, 'text': 'And in this case it returns false, because a super set returns true if the first set contains all the numbers or all the elements from the second set.', 'start': 3293.095, 'duration': 14.664}, {'end': 3313.942, 'text': 'So set B does not contain 546.', 'start': 3308.82, 'duration': 5.122}, {'end': 3315.284, 'text': "So it's not a superset.", 'start': 3313.942, 'duration': 1.342}, {'end': 3322.877, 'text': 'But set A is a superset of set B, because it contains one, two, and three.', 'start': 3315.865, 'duration': 7.012}, {'end': 3329.037, 'text': 'And we can calculate if two sets are disjoint.', 'start': 3325.234, 'duration': 3.803}, {'end': 3340.007, 'text': 'So this joint returns true if both sets have a null intersection, so no same elements.', 'start': 3329.157, 'duration': 10.85}, {'end': 3349.035, 'text': 'So set A is this joint set B.', 'start': 3340.087, 'duration': 8.948}, {'end': 3354.368, 'text': 'And if you print this, this will return false because they have same elements.', 'start': 3349.035, 'duration': 5.333}, {'end': 3369.422, 'text': 'And if we create, for example, a set C and put seven, eight in here, and check, set a is this joint with set B, then this will give us true.', 'start': 3354.608, 'duration': 14.814}, {'end': 3374.812, 'text': "Now let's briefly talk about copying two sets.", 'start': 3371.491, 'duration': 3.321}, {'end': 3382.415, 'text': 'If you have watched the previous episodes about lists, for example, then you already know this.', 'start': 3375.213, 'duration': 7.202}, {'end': 3389.558, 'text': 'you have to be careful when you want to copy two sets and only do this with a simple assignment.', 'start': 3382.415, 'duration': 7.143}, {'end': 3396.541, 'text': "So let's say let set B equals to set one set a.", 'start': 3389.638, 'duration': 6.903}, {'end': 3402.111, 'text': 'First of all, if you print this, then we see that we have a copy.', 'start': 3396.541, 'duration': 5.57}, {'end': 3410.255, 'text': "But now if we modify the copy, let's say set B at seven.", 'start': 3402.712, 'duration': 7.543}, {'end': 3422.53, 'text': 'And if we print the copy, and also print the original one, then we see that also the original one changed.', 'start': 3411.296, 'duration': 11.234}, {'end': 3429.536, 'text': 'Because with this simple assignment, both points to the same set.', 'start': 3423.211, 'duration': 6.325}, {'end': 3433.619, 'text': 'So be careful here, you only copy the reference.', 'start': 3430.477, 'duration': 3.142}, {'end': 3438.984, 'text': 'Now if you want to make an actual copy, you have to use the dot copy method.', 'start': 3434.44, 'duration': 4.544}, {'end': 3444.368, 'text': "So if you run this again, and we see that the original set didn't change.", 'start': 3439.384, 'duration': 4.984}], 'summary': 'The transcript explains set operations including subset, superset, disjoint, and copying sets in python.', 'duration': 69.155, 'max_score': 3201.847, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo3201847.jpg'}], 'start': 1769.966, 'title': 'Python data structures', 'summary': 'Discusses the efficiency of tuples compared to lists, detailed insights into working with dictionaries, dictionary operations, key types, sets in python, set operations, working with sets, and frozen sets, providing various examples and best practices.', 'chapters': [{'end': 2058.973, 'start': 1769.966, 'title': 'Efficiency of tuples and working with dictionaries', 'summary': 'Discusses the efficiency of working with tuples compared to lists, and provides detailed insights into creating, accessing, updating, and deleting items in dictionaries, along with examples and best practices.', 'duration': 289.007, 'highlights': ['Dictionaries are more efficient than lists and tuples for certain operations, as seen by the time taken for creation.', 'Dictionaries are unordered and mutable, consisting of key-value pairs, created with braces and colon-separated key-value pairs, and can also be created using the dict function.', 'Accessing values in dictionaries is done by specifying the key, and attempting to access a non-existent key leads to a key error.', "Dictionaries are mutable and allow addition, modification, and deletion of key-value pairs using methods like 'pop', 'popitem', and the 'del' statement."]}, {'end': 2533.648, 'start': 2060.655, 'title': 'Dictionary operations and key types', 'summary': 'Covers methods to check, access, loop through, copy, merge, and key types within a dictionary, including examples of using if in statements, try except statements, for in loops, copying dictionaries, merging dictionaries, and using different key types such as numbers and tuples.', 'duration': 472.993, 'highlights': ['The if in statement can be used to check if a key is inside a dictionary, and the try except statement can handle exceptions when accessing a key, with examples showing how to use these statements and their outcomes. if in statement; try except statement', 'Different methods to loop through a dictionary, including using for in loops, dot keys, dot values, and dot items, with examples illustrating how to use each method and the output. looping through a dictionary', 'Methods to copy a dictionary, such as using simple assignment, the built-in copy function, and the dict function, with examples demonstrating the results of each method. copying a dictionary', 'The update method for merging two dictionaries, with an example showcasing how the update method overwrites existing key-value pairs and adds non-existing keys. update method for merging dictionaries', 'Explanation of using different key types, including numbers and tuples, as keys in a dictionary, with examples and cautions about accessing values with non-string keys. using different key types']}, {'end': 2746.778, 'start': 2533.728, 'title': 'Sets in python', 'summary': 'Explains the concept of sets in python, highlighting their properties such as being unordered, mutable, and not allowing duplicate elements, as well as demonstrating various methods for adding, removing, and manipulating elements within a set.', 'duration': 213.05, 'highlights': ['A set in Python is a collection data type that is unordered and mutable, and does not allow duplicate elements.', 'The chapter demonstrates the use of the set function to create a set from an iterable, such as a list or a string.', "The chapter explains the methods for adding and removing elements from a set, including 'add', 'remove', 'discard', 'clear', and 'pop'."]}, {'end': 3212.817, 'start': 2749.06, 'title': 'Set operations in python', 'summary': 'Discusses set operations in python, including iteration, checking for elements, union, intersection, difference, symmetric difference, and methods to modify the original sets.', 'duration': 463.757, 'highlights': ['The chapter discusses set operations in Python, including iteration, checking for elements, union, intersection, difference, symmetric difference, and methods to modify the original sets. Covers key set operations in Python, such as iteration, checking for elements, union, intersection, difference, symmetric difference, and methods to modify original sets.', 'The union combines elements from both sets without duplication, demonstrated by the calculation of the union of odd and even numbers resulting in all numbers from zero to nine. Demonstrates the union operation by calculating the union of odd and even numbers, resulting in all numbers from zero to nine without duplication.', 'The intersection operation returns elements found in both sets, shown by the calculation of the intersection of odd and prime numbers resulting in 3, 5, and 7 as the intersection. Illustrates the intersection operation by calculating the intersection of odd and prime numbers, resulting in 3, 5, and 7 as the common elements.', 'The difference operation returns elements from the first set that are not in the second set, demonstrated by the calculation of the difference between two sets resulting in numbers from four to nine. Explains the difference operation by calculating the difference between two sets, resulting in numbers from four to nine as the elements only in the first set.', 'The symmetric difference operation returns elements from both sets that are not common, demonstrated by the calculation of symmetric difference resulting in 1, 2, 3, 10, 11, 12. Describes the symmetric difference operation by calculating the symmetric difference, resulting in elements from both sets that are not common, such as 1, 2, 3, 10, 11, 12.', 'Methods to modify sets in place are discussed, such as update, intersection update, difference update, and symmetric difference update. Explains methods to modify sets in place, including update, intersection update, difference update, and symmetric difference update.']}, {'end': 3523.403, 'start': 3214.909, 'title': 'Working with sets and frozen sets', 'summary': 'Covers concepts such as subset, superset, disjoint, copying sets, and frozen sets, with examples and cautionary points about set manipulation and usage.', 'duration': 308.494, 'highlights': ['The opposite is called the super set method, which returns true if the first set contains all the numbers or all the elements from the second set, with set A being a superset of set B, containing one, two, and three. super set method, returns true, set A is a superset of set B, contains one, two, and three.', 'Subset method returns false when set A is not a subset of set B, while superset method returns false as set B does not contain 546, but set A is a superset of set B, containing one, two, and three. subset method, returns false, set A is not a subset of set B, superset method, returns false, set B does not contain 546, set A is a superset of set B, contains one, two, and three.', 'The disjoint method returns true if both sets have a null intersection, so no same elements, with set A being disjoint with set B, and set C being disjoint with set B. disjoint method, returns true, set A is disjoint with set B, set C is disjoint with set B.', 'Using simple assignment for copying sets may lead to unexpected behavior, as modifying the copied set will also change the original set; instead, use the dot copy method or the set method for an actual copy. simple assignment for copying sets, modifying the copied set will change the original set, use dot copy method or set method for an actual copy.', 'Frozen sets are immutable versions of normal sets, created using the frozen set method, and do not allow modification after creation, unlike normal sets. Frozen sets, immutable versions of normal sets, do not allow modification after creation.']}], 'duration': 1753.437, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo1769966.jpg', 'highlights': ['Dictionaries are more efficient than lists and tuples for certain operations, as seen by the time taken for creation.', 'The chapter discusses set operations in Python, including iteration, checking for elements, union, intersection, difference, symmetric difference, and methods to modify the original sets.', 'The update method for merging two dictionaries, with an example showcasing how the update method overwrites existing key-value pairs and adds non-existing keys.', 'The union combines elements from both sets without duplication, demonstrated by the calculation of the union of odd and even numbers resulting in all numbers from zero to nine.', 'The if in statement can be used to check if a key is inside a dictionary, and the try except statement can handle exceptions when accessing a key, with examples showing how to use these statements and their outcomes.']}, {'end': 5579.536, 'segs': [{'end': 3653.568, 'src': 'embed', 'start': 3625.113, 'weight': 0, 'content': [{'end': 3630.576, 'text': 'So now if we run this, we see that our string goes over multiple lines.', 'start': 3625.113, 'duration': 5.463}, {'end': 3636.529, 'text': 'Now you may also sometimes see an escaping backslash like so.', 'start': 3631.604, 'duration': 4.925}, {'end': 3641.355, 'text': 'And this just says that the string should continue in another line.', 'start': 3637.37, 'duration': 3.985}, {'end': 3645.539, 'text': 'But it should not create a new line here.', 'start': 3641.895, 'duration': 3.644}, {'end': 3653.568, 'text': 'So now if we run this, then we see we have our one line hello world string.', 'start': 3645.679, 'duration': 7.889}], 'summary': 'Demonstrates string handling with multiple lines and escaping characters.', 'duration': 28.455, 'max_score': 3625.113, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo3625113.jpg'}, {'end': 3856.974, 'src': 'embed', 'start': 3816.014, 'weight': 2, 'content': [{'end': 3820.329, 'text': 'And now if I put a two here, it takes every second character.', 'start': 3816.014, 'duration': 4.315}, {'end': 3824.132, 'text': 'And I can also put a minus one here.', 'start': 3821.47, 'duration': 2.662}, {'end': 3828.034, 'text': 'And then what it does, it will reverse our string.', 'start': 3824.812, 'duration': 3.222}, {'end': 3834.338, 'text': "So that's a nice little trick to reverse the string with this slicing operator.", 'start': 3828.494, 'duration': 5.844}, {'end': 3842.142, 'text': 'Now we can concatenate two or more strings simply with a plus.', 'start': 3836.439, 'duration': 5.703}, {'end': 3856.974, 'text': 'So if I create another string, Tom, And I will just call this Hello, and say, this is now a greeting.', 'start': 3843.323, 'duration': 13.651}], 'summary': 'Using python slicing, every 2nd character can be extracted and strings can be concatenated with a plus sign.', 'duration': 40.96, 'max_score': 3816.014, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo3816014.jpg'}, {'end': 4638.144, 'src': 'embed', 'start': 4607.353, 'weight': 1, 'content': [{'end': 4615.854, 'text': 'So if you run this now, what we will see that this the second way with a dot join method is much faster.', 'start': 4607.353, 'duration': 8.501}, {'end': 4623.776, 'text': 'So the first way took more than half a second and the second only point 01 seconds.', 'start': 4616.495, 'duration': 7.281}, {'end': 4628.317, 'text': 'So forget this way of doing it.', 'start': 4624.616, 'duration': 3.701}, {'end': 4630.497, 'text': 'And remember that dot join method.', 'start': 4628.777, 'duration': 1.72}, {'end': 4638.144, 'text': 'Now as a last thing, I want to talk about formatting strings.', 'start': 4633.123, 'duration': 5.021}], 'summary': 'Using dot join method reduced time from 0.5s to 0.01s for string formatting.', 'duration': 30.791, 'max_score': 4607.353, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo4607353.jpg'}, {'end': 4969.221, 'src': 'embed', 'start': 4944.373, 'weight': 3, 'content': [{'end': 4955.567, 'text': "So let's say as a mathematical operation, like var times two, And then this will will be evaluated at runtime.", 'start': 4944.373, 'duration': 11.194}, {'end': 4960.592, 'text': 'So now we see we have our two times our variable here.', 'start': 4956.127, 'duration': 4.465}, {'end': 4965.417, 'text': "And yeah, so that's it about f strings.", 'start': 4961.553, 'duration': 3.864}, {'end': 4969.221, 'text': "And that's all I wanted to show you about the strings.", 'start': 4965.997, 'duration': 3.224}], 'summary': 'Demonstrating the use of f strings and mathematical operations on variables.', 'duration': 24.848, 'max_score': 4944.373, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo4944373.jpg'}, {'end': 5254.757, 'src': 'embed', 'start': 5221.994, 'weight': 4, 'content': [{'end': 5229.165, 'text': 'So now if I print it, then I will see I will get all the different elements here as a list.', 'start': 5221.994, 'duration': 7.171}, {'end': 5232.967, 'text': 'And I can, for example, iterate over this.', 'start': 5230.386, 'duration': 2.581}, {'end': 5239.19, 'text': "So that's the counter next talk about the names tuple.", 'start': 5235.368, 'duration': 3.822}, {'end': 5242.851, 'text': 'And of course, first of all, we have to import it.', 'start': 5239.77, 'duration': 3.081}, {'end': 5246.373, 'text': 'So we say from collections, import named tuple.', 'start': 5242.951, 'duration': 3.422}, {'end': 5254.757, 'text': 'And the named tuples is an easy to create and lightweight object type, similar to a struct.', 'start': 5247.233, 'duration': 7.524}], 'summary': 'Explains using named tuples for creating lightweight object types.', 'duration': 32.763, 'max_score': 5221.994, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo5221994.jpg'}], 'start': 3527.955, 'title': 'Python string basics and manipulation', 'summary': 'Covers python string basics such as string creation, handling single quotes, and multi-line strings. it also discusses string manipulation techniques including accessing characters, substrings, concatenation, and useful methods like strip.', 'chapters': [{'end': 3653.568, 'start': 3527.955, 'title': 'Python string basics', 'summary': 'Introduces the basics of python strings, highlighting the creation of strings using single or double quotes, handling single quotes within strings, using triple quotes for multi-line strings and documentation, and utilizing escaping backslash to continue strings in another line.', 'duration': 125.613, 'highlights': ['A string is an ordered and immutable collection data type used for text representation and one of the most used data types in Python.', 'Strings can be created using either single or double quotes, with single quotes being more common, and triple quotes for multi-line strings and documentation.', 'To handle single quotes within a string, one can use an escaping backslash or put the single quote inside double quotes.', 'Escaping backslash can also be used to continue a string in another line without creating a new line.']}, {'end': 4043.076, 'start': 3655.484, 'title': 'String manipulation in python', 'summary': 'Discusses accessing characters and substrings in python strings, including using indexes, slicing, concatenation, iteration, checking for substrings, and utilizing useful methods like strip.', 'duration': 387.592, 'highlights': ['The chapter explains how to access characters and substrings in Python strings, demonstrating the use of indexes, slicing, and the inability to change individual characters due to string immutability.', "It also covers string concatenation using the plus operator and iterating over strings using a for-in loop, showcasing an example of checking for the presence of characters or substrings within a string using the 'if in' statement.", 'Additionally, the chapter introduces useful methods like strip for removing whitespace from strings, emphasizing that these methods do not change the original string in place due to string immutability.']}, {'end': 4606.793, 'start': 4045.126, 'title': 'Python strings and lists basics', 'summary': 'Covers various string methods including upper and lower case conversion, checking for specific characters or substrings, finding index of characters or substrings, counting occurrences, and replacing characters or substrings. it also explains how to split a string into a list and join a list back into a string, emphasizing the efficiency of the join method over using a for loop.', 'duration': 561.667, 'highlights': ['The chapter covers various string methods including upper and lower case conversion, checking for specific characters or substrings, finding index of characters or substrings, counting occurrences, and replacing characters or substrings. The transcript introduces and demonstrates various string methods such as upper and lower case conversion, checking for specific characters or substrings, finding index of characters or substrings, counting occurrences, and replacing characters or substrings.', 'It also explains how to split a string into a list and join a list back into a string, emphasizing the efficiency of the join method over using a for loop. The chapter explains the process of splitting a string into a list and joining a list back into a string, highlighting the efficiency of using the join method over a for loop for this purpose.', 'The chapter emphasizes the efficiency of the join method over using a for loop for joining a list back into a string. The transcript emphasizes the efficiency of using the join method over a for loop for joining a list back into a string, citing the join method as a faster and cleaner approach.']}, {'end': 4969.221, 'start': 4607.353, 'title': 'Python string formatting methods', 'summary': 'Discusses three different string formatting methods: old style with percent operator, dot format method, and f strings, highlighting the performance comparison and syntax differences, with the f strings being the most recommended method due to its readability, conciseness, and speed in python 3.6.', 'duration': 361.868, 'highlights': ['The F strings method for string formatting in Python 3.6 or newer is highly recommended due to its readability, conciseness, and speed, especially with multiple variables, as it evaluates the expressions at runtime.', 'The dot format method for string formatting allows the use of braces as placeholders and provides the ability to specify the number of digits after the decimal point, making it a more modern and flexible alternative to the old formatting styles.', 'The old style string formatting with the percent operator involves placeholders such as percent s for strings, percent D for integer decimal values, and percent f for floating point values, but it is less recommended due to its complexity and slower performance.']}, {'end': 5579.536, 'start': 4973.595, 'title': 'Collections module overview', 'summary': 'Introduces the collections module and discusses five different types from the module: counter, named tuple, ordered dict, default dict, and deck, with detailed explanations and examples of each type.', 'duration': 605.941, 'highlights': ['The counter is a container that stores elements as dictionary keys and their counts as dictionary values, and can provide functionality to access items, keys, values, and the most common elements in the counter dictionary. The counter stores elements as dictionary keys and their counts as dictionary values. It provides functionality to access items, keys, values, and the most common elements in the counter dictionary.', 'The named tuple is an easy to create and lightweight object type, similar to a struct, and allows the creation of named tuples with defined fields. The named tuple is a lightweight object type similar to a struct, and it allows the creation of named tuples with defined fields.', 'The ordered dict is similar to a regular dictionary but remembers the order that the items were inserted, making it useful for maintaining the insertion order in dictionaries for older Python versions. The ordered dict is similar to a regular dictionary but remembers the order of insertion, making it useful for maintaining insertion order in dictionaries for older Python versions.', 'The default dict is similar to a usual dictionary container but has a default value if the key has not been set yet, and allows specifying the default type for missing keys. The default dict has a default value for missing keys and allows specifying the default type for missing keys.']}], 'duration': 2051.581, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo3527955.jpg', 'highlights': ['Strings can be created using either single or double quotes, with single quotes being more common, and triple quotes for multi-line strings and documentation.', 'The F strings method for string formatting in Python 3.6 or newer is highly recommended due to its readability, conciseness, and speed, especially with multiple variables, as it evaluates the expressions at runtime.', 'The chapter covers various string methods including upper and lower case conversion, checking for specific characters or substrings, finding index of characters or substrings, counting occurrences, and replacing characters or substrings.', 'The dot format method for string formatting allows the use of braces as placeholders and provides the ability to specify the number of digits after the decimal point, making it a more modern and flexible alternative to the old formatting styles.', 'The ordered dict is similar to a regular dictionary but remembers the order that the items were inserted, making it useful for maintaining the insertion order in dictionaries for older Python versions.']}, {'end': 7380.861, 'segs': [{'end': 5888.646, 'src': 'embed', 'start': 5841.179, 'weight': 0, 'content': [{'end': 5847.623, 'text': 'So we say from iter tools, import product.', 'start': 5841.179, 'duration': 6.444}, {'end': 5860.932, 'text': "And let's say we have two lists a equals one and two and B equals a list with three and four.", 'start': 5849.284, 'duration': 11.648}, {'end': 5870.719, 'text': 'And then we say we have a product of A and B.', 'start': 5861.652, 'duration': 9.067}, {'end': 5875.861, 'text': 'And the product will compute the Cartesian product of the input iterables.', 'start': 5870.719, 'duration': 5.142}, {'end': 5878.702, 'text': "So let's print this.", 'start': 5876.721, 'duration': 1.981}, {'end': 5882.703, 'text': 'So print the product.', 'start': 5878.862, 'duration': 3.841}, {'end': 5887.245, 'text': 'And then we will see that we have a iter tools object.', 'start': 5883.604, 'duration': 3.641}, {'end': 5888.646, 'text': 'So this is an iterator.', 'start': 5887.325, 'duration': 1.321}], 'summary': "Using itertools' product to compute cartesian product of input iterables.", 'duration': 47.467, 'max_score': 5841.179, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo5841179.jpg'}, {'end': 6142.541, 'src': 'embed', 'start': 6015.806, 'weight': 2, 'content': [{'end': 6023.491, 'text': 'So if we want to have shorter permutations, permutations with only length two, we give it the argument two.', 'start': 6015.806, 'duration': 7.685}, {'end': 6030.015, 'text': 'And then we see different orderings with the length of two, so 121321, and so on.', 'start': 6024.191, 'duration': 5.824}, {'end': 6036.079, 'text': "that's permutations, then we have combinations.", 'start': 6032.998, 'duration': 3.081}, {'end': 6039.9, 'text': 'So from either tools, import combinations.', 'start': 6036.239, 'duration': 3.661}, {'end': 6053.525, 'text': 'And the combinations function will make all possible combinations with a specified length.', 'start': 6041.541, 'duration': 11.984}, {'end': 6056.886, 'text': "So let's also make an example here.", 'start': 6053.905, 'duration': 2.981}, {'end': 6059.547, 'text': "Let's make a list 123 and four.", 'start': 6057.686, 'duration': 1.861}, {'end': 6068.782, 'text': 'and then say comp equals combinations of a.', 'start': 6061.599, 'duration': 7.183}, {'end': 6072.884, 'text': 'And the second argument with the length here is mandatory.', 'start': 6068.782, 'duration': 4.102}, {'end': 6081.248, 'text': 'So in this example, I only want the length two, and then print this again as a list.', 'start': 6073.004, 'duration': 8.244}, {'end': 6090.882, 'text': 'And then we will see all possible combinations with length two, so 121314.', 'start': 6083.649, 'duration': 7.233}, {'end': 6094.245, 'text': 'two, three, two, four, and three, four.', 'start': 6090.882, 'duration': 3.363}, {'end': 6102.672, 'text': "And, and note that we don't have combinations of the same arguments.", 'start': 6095.546, 'duration': 7.126}, {'end': 6104.254, 'text': 'So no repetitions here.', 'start': 6102.732, 'duration': 1.522}, {'end': 6111.059, 'text': 'And if we want that we can also use the combinations with replacement function.', 'start': 6104.894, 'duration': 6.165}, {'end': 6113.301, 'text': 'So then we import it.', 'start': 6111.4, 'duration': 1.901}, {'end': 6118.386, 'text': 'So import combinations with replacement.', 'start': 6113.341, 'duration': 5.045}, {'end': 6142.541, 'text': "And then let's make another combination iterable and say combinations with replacement of a and also of length two and print this comp with replacements.", 'start': 6119.736, 'duration': 22.805}], 'summary': 'The transcript explains permutations and combinations, showcasing examples and their outcomes.', 'duration': 126.735, 'max_score': 6015.806, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo6015806.jpg'}, {'end': 6224.813, 'src': 'embed', 'start': 6177.869, 'weight': 1, 'content': [{'end': 6182.43, 'text': 'First of all, import the accumulate function.', 'start': 6177.869, 'duration': 4.561}, {'end': 6188.812, 'text': 'And then we can say, we leave the list a equals 123 and four.', 'start': 6183.23, 'duration': 5.582}, {'end': 6199.998, 'text': 'And then we say, accumulate equals accumulate of a and print this.', 'start': 6190.572, 'duration': 9.426}, {'end': 6208.283, 'text': "First of all, let's print our list and then print the accumulated list.", 'start': 6200.839, 'duration': 7.444}, {'end': 6217.029, 'text': 'So we see that our list is one, two, and three.', 'start': 6211.725, 'duration': 5.304}, {'end': 6221.771, 'text': 'And the accumulated sums is 136 and 10.', 'start': 6217.289, 'duration': 4.482}, {'end': 6224.813, 'text': 'So the first elements stays the same.', 'start': 6221.771, 'duration': 3.042}], 'summary': "Using the accumulate function on list 'a' yields an accumulated sum of 136 and 10.", 'duration': 46.944, 'max_score': 6177.869, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo6177869.jpg'}, {'end': 6389.965, 'src': 'embed', 'start': 6339.374, 'weight': 5, 'content': [{'end': 6361.046, 'text': 'And then we say we make a group object, and that is group by and then we want to group a, and we have to give it a key, which has to be applied.', 'start': 6339.374, 'duration': 21.672}, {'end': 6364.889, 'text': 'So as key, we can define a function.', 'start': 6361.146, 'duration': 3.743}, {'end': 6378.4, 'text': "So let's say smaller than three, and give it an input, and then return x smaller than three.", 'start': 6365.029, 'duration': 13.371}, {'end': 6381.242, 'text': 'So this will return true or false.', 'start': 6378.48, 'duration': 2.762}, {'end': 6385.463, 'text': 'And as a key, we will give it this function.', 'start': 6382.242, 'duration': 3.221}, {'end': 6389.965, 'text': "And then let's print this.", 'start': 6387.244, 'duration': 2.721}], 'summary': 'Demonstrates grouping objects using a key function.', 'duration': 50.591, 'max_score': 6339.374, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo6339374.jpg'}], 'start': 5580.397, 'title': 'Python iterators and functions', 'summary': 'Covers python collections, default dict, and deck, explaining their functionalities, iter tools module and its functions, itertools overview, lambda functions, infinite iterators, sorting lists, and transforming data in python.', 'chapters': [{'end': 5777.385, 'start': 5580.397, 'title': 'Python collections: default dict and deck', 'summary': 'Introduces the default dict, which returns a default value when a key error occurs, and explains the functionalities of the deck, a double ended queue, highlighting efficient element addition, removal from both ends, and rotation.', 'duration': 196.988, 'highlights': ['The default dict returns a default value when a key error occurs, providing efficient error handling compared to a normal dictionary.', 'The deck, a double ended queue, facilitates efficient addition and removal of elements from both ends, as well as rotation of elements within the queue.', 'Demonstrating the use of the deck, the transcript includes examples of appending, extending, and rotating elements, showcasing the practical functionalities of the data structure.']}, {'end': 6142.541, 'start': 5778.098, 'title': 'Iter tools: advanced iterators', 'summary': 'Explains the iter tools module, covering functions such as product, permutations, combinations, and their respective outputs, demonstrating the use of iterators in python.', 'duration': 364.443, 'highlights': ['The iter tools module provides advanced tools for handling iterators, including functions like product, permutations, and combinations. The iter tools module offers advanced tools such as product, permutations, and combinations.', 'The product function computes the Cartesian product of the input iterables, allowing for the specification of a number of repetitions. The product function computes the Cartesian product of the input iterables and allows for specifying the number of repetitions.', 'The permutations function returns all possible orderings of an input, with the option to specify the length of the permutations. The permutations function returns all possible orderings of an input, with the option to specify the length of the permutations.', 'The combinations function creates all possible combinations of a specified length from the input, and the combinations with replacement function can be used to include repetitions. The combinations function creates all possible combinations of a specified length from the input, and the combinations with replacement function can be used to include repetitions.']}, {'end': 6429.187, 'start': 6143.521, 'title': 'Itertools functions overview', 'summary': 'Introduces itertools functions, showcasing the combination, accumulate, and group by functions. it demonstrates the use of accumulate function to compute accumulated sums and other binary functions, including examples of addition, multiplication, and finding the maximum value. additionally, it illustrates the group by function to create keys and groups from an iterable list based on a defined function.', 'duration': 285.666, 'highlights': ['The chapter introduces the accumulate function, which computes accumulated sums or any other binary function, with examples of addition, multiplication, and finding the maximum value.', 'It explains the group by function, which creates keys and groups from an iterable list based on a defined function.', 'The combination function, with examples of combinations and combinations with replay replacement, is discussed.']}, {'end': 6892.312, 'start': 6429.888, 'title': 'Lambda functions and iterators', 'summary': 'Covers lambda functions, infinite iterators, and their applications, such as grouping elements based on a condition, creating an infinite loop, and using lambda functions in built-in functions like map, filter, and reduce.', 'duration': 462.424, 'highlights': ['Lambda functions: syntax and usage Explains lambda functions as small one-line functions with examples of grouping elements based on a condition and creating a function with arguments, evaluating an expression, and returning the result.', 'Infinite iterators: count, cycle, and repeat methods Describes count method for creating an infinite loop with a start value and breaking at a specified condition, cycle method for cycling through an iterable, and repeat method for creating an infinite loop with a stop repetition.', 'Applications of lambda functions Discusses the typical use cases of lambda functions, including their use as simple functions used only once in code or as arguments for higher-order functions, and their usage in built-in functions like sorted, map, filter, and reduce.']}, {'end': 7380.861, 'start': 6892.372, 'title': 'Sorting and transforming data in python', 'summary': 'Covers sorting lists using the sorted method with lambda key argument, mapping a function to a list using the map function and filtering elements using the filter function and lambda. it also discusses the reduce function to repeatedly apply a function to the elements in a sequence and return a single value.', 'duration': 488.489, 'highlights': ['The sorted method in Python can be used to sort lists, and it can take a key argument with a lambda function to specify the sorting rule, such as sorting by the y value of a tuple.', 'The map function transforms each element of a sequence using a specified function, and it can be achieved with list comprehension as well, where each element of the list gets multiplied by two.', 'The filter function in Python can be used to filter elements of a sequence based on a given condition, such as filtering even numbers from a list, and it can also be achieved using list comprehension with a condition for filtering even numbers.', 'The reduce function in Python repeatedly applies a function to the elements of a sequence and returns a single value, such as computing the product of all elements in a list.']}], 'duration': 1800.464, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo5580397.jpg', 'highlights': ['The default dict returns a default value when a key error occurs, providing efficient error handling compared to a normal dictionary.', 'The deck, a double ended queue, facilitates efficient addition and removal of elements from both ends, as well as rotation of elements within the queue.', 'The iter tools module provides advanced tools for handling iterators, including functions like product, permutations, and combinations.', 'The product function computes the Cartesian product of the input iterables, allowing for the specification of a number of repetitions.', 'The permutations function returns all possible orderings of an input, with the option to specify the length of the permutations.', 'The combinations function creates all possible combinations of a specified length from the input, and the combinations with replacement function can be used to include repetitions.', 'The chapter introduces the accumulate function, which computes accumulated sums or any other binary function, with examples of addition, multiplication, and finding the maximum value.', 'It explains the group by function, which creates keys and groups from an iterable list based on a defined function.', 'Lambda functions: syntax and usage Explains lambda functions as small one-line functions with examples of grouping elements based on a condition and creating a function with arguments, evaluating an expression, and returning the result.', 'Infinite iterators: count, cycle, and repeat methods Describes count method for creating an infinite loop with a start value and breaking at a specified condition, cycle method for cycling through an iterable, and repeat method for creating an infinite loop with a stop repetition.', 'The sorted method in Python can be used to sort lists, and it can take a key argument with a lambda function to specify the sorting rule, such as sorting by the y value of a tuple.', 'The map function transforms each element of a sequence using a specified function, and it can be achieved with list comprehension as well, where each element of the list gets multiplied by two.', 'The filter function in Python can be used to filter elements of a sequence based on a given condition, such as filtering even numbers from a list, and it can also be achieved using list comprehension with a condition for filtering even numbers.', 'The reduce function in Python repeatedly applies a function to the elements of a sequence and returns a single value, such as computing the product of all elements in a list.']}, {'end': 8142.667, 'segs': [{'end': 7569.114, 'src': 'embed', 'start': 7535.478, 'weight': 2, 'content': [{'end': 7543.301, 'text': 'And now if I run this, then this will raise a type error unsupported operand types for plus int and string.', 'start': 7535.478, 'duration': 7.823}, {'end': 7546.282, 'text': 'So this is a type error.', 'start': 7544.161, 'duration': 2.121}, {'end': 7552.984, 'text': "And now let's talk about some more common built in exceptions.", 'start': 7547.602, 'duration': 5.382}, {'end': 7557.165, 'text': 'So of course, there is the import error.', 'start': 7553.144, 'duration': 4.021}, {'end': 7569.114, 'text': 'So if I say import and then some module that does not exist, then this will raise a module not found error, which is a subclass from the import error.', 'start': 7557.225, 'duration': 11.889}], 'summary': 'Running the code raises type error. discusses import error.', 'duration': 33.636, 'max_score': 7535.478, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo7535478.jpg'}, {'end': 7713.224, 'src': 'embed', 'start': 7675.674, 'weight': 5, 'content': [{'end': 7683.799, 'text': 'So for example, if I try to access the index for, then this will raise an index error list index out of range.', 'start': 7675.674, 'duration': 8.125}, {'end': 7692.924, 'text': "And if I have a dictionary, so let's say I have a dictionary with a name.", 'start': 7685.06, 'duration': 7.864}, {'end': 7696.306, 'text': 'And the name is Max.', 'start': 7694.425, 'duration': 1.881}, {'end': 7700.329, 'text': 'And it has only the key value pair of the name.', 'start': 7697.087, 'duration': 3.242}, {'end': 7713.224, 'text': 'And I want to access, for example, I want to access the age, then this will raise a key error because the H key is not inside my dictionary.', 'start': 7701.539, 'duration': 11.685}], 'summary': "Accessing non-existent index in a list raises 'index error' while accessing a non-existent key in a dictionary raises 'key error'.", 'duration': 37.55, 'max_score': 7675.674, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo7675674.jpg'}, {'end': 7950.621, 'src': 'embed', 'start': 7868.106, 'weight': 0, 'content': [{'end': 7869.827, 'text': 'And this will raise an error.', 'start': 7868.106, 'duration': 1.721}, {'end': 7879.012, 'text': "So let's simply run this and show you what happens.", 'start': 7871.168, 'duration': 7.844}, {'end': 7885.712, 'text': 'So this will raise a zero division error, because division by zero is not allowed.', 'start': 7880.171, 'duration': 5.541}, {'end': 7887.472, 'text': 'So what I can do.', 'start': 7886.272, 'duration': 1.2}, {'end': 7892.193, 'text': 'then I can make a try, except block.', 'start': 7887.472, 'duration': 4.721}, {'end': 7896.894, 'text': 'so I will try this statement and then I can write except.', 'start': 7892.193, 'duration': 4.701}, {'end': 7901.915, 'text': 'so if an exception is raised, then the code will continue here.', 'start': 7896.894, 'duration': 5.021}, {'end': 7911.265, 'text': 'And then I can simply print an error happened.', 'start': 7902.596, 'duration': 8.669}, {'end': 7922.268, 'text': "So if I run this, then your program doesn't stop here, it will continue and it will continue in this line.", 'start': 7913.146, 'duration': 9.122}, {'end': 7927.089, 'text': 'And you can also catch the type of exception.', 'start': 7924.109, 'duration': 2.98}, {'end': 7935.692, 'text': 'So you can write except exception as E.', 'start': 7927.209, 'duration': 8.483}, {'end': 7938.554, 'text': 'And then you can print your exception.', 'start': 7935.692, 'duration': 2.862}, {'end': 7950.621, 'text': 'So you can if I run this, then it prints the division by zero message from the zero division error class.', 'start': 7938.674, 'duration': 11.947}], 'summary': 'Demonstrating error handling with try-except block in python.', 'duration': 82.515, 'max_score': 7868.106, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo7868106.jpg'}], 'start': 7381.161, 'title': 'Python functions and exceptions', 'summary': 'Covers lambda function and reduce usage in python, illustrating the calculation of the product of a sequence. it also explains syntax errors, exceptions, built-in exceptions, and how to raise and handle exceptions with try-except blocks, assert statements, else and finally clauses.', 'chapters': [{'end': 7453.77, 'start': 7381.161, 'title': 'Lambda function and reduce in python', 'summary': 'Introduces the lambda function in python, explaining its usage with the reduce function and demonstrating how it can be used to calculate the product of a sequence, such as 1*2*3*4, resulting in 24.', 'duration': 72.609, 'highlights': ['The reduce function in Python is used to apply a specified function to the elements of a sequence to reduce it to a single value, for example, calculating the product of a sequence.', 'The example demonstrates the usage of a lambda function with the reduce function to calculate and print the product of a sequence, such as 1*2*3*4, which equals 24.', 'Python program terminates as soon as it encounters an error, which can either be a syntax error or an exception.']}, {'end': 8142.667, 'start': 7454.37, 'title': 'Difference between syntax error and exception, built-in exceptions, raising and handling exceptions', 'summary': 'Explains the difference between syntax errors and exceptions, highlights common built-in exceptions such as type error, import error, name error, file not found error, value error, index error, and key error, and outlines how to raise and handle exceptions using try-except blocks, assert statements, and demonstrate the usage of else and finally clauses.', 'duration': 688.297, 'highlights': ['Common built-in exceptions include type error, import error, name error, file not found error, value error, index error, and key error. The chapter discusses various common built-in exceptions, such as type error, import error, name error, file not found error, value error, index error, and key error, providing examples of each.', 'The chapter outlines how to raise exceptions using the raise keyword and the assert statement, demonstrating the usage of both methods with examples. It explains how to raise exceptions using the raise keyword and the assert statement, showcasing examples of both methods and their implementation.', 'The chapter explains how to handle exceptions using try-except blocks, highlighting the usage of try-except blocks to catch and handle different types of exceptions, along with the usage of else and finally clauses. It details the handling of exceptions using try-except blocks, emphasizing the use of try-except blocks to catch and handle various exceptions, and demonstrates the implementation of else and finally clauses.']}], 'duration': 761.506, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo7381161.jpg', 'highlights': ['The reduce function in Python is used to apply a specified function to the elements of a sequence to reduce it to a single value, for example, calculating the product of a sequence.', 'The example demonstrates the usage of a lambda function with the reduce function to calculate and print the product of a sequence, such as 1*2*3*4, which equals 24.', 'The chapter outlines how to raise exceptions using the raise keyword and the assert statement, demonstrating the usage of both methods with examples.', 'The chapter explains how to handle exceptions using try-except blocks, highlighting the usage of try-except blocks to catch and handle different types of exceptions, along with the usage of else and finally clauses.', 'Python program terminates as soon as it encounters an error, which can either be a syntax error or an exception.', 'Common built-in exceptions include type error, import error, name error, file not found error, value error, index error, and key error. The chapter discusses various common built-in exceptions, such as type error, import error, name error, file not found error, value error, index error, and key error, providing examples of each.']}, {'end': 9685.992, 'segs': [{'end': 8302.584, 'src': 'embed', 'start': 8266.884, 'weight': 3, 'content': [{'end': 8273.466, 'text': "and then print, let's catch the value to high error se and then print E.", 'start': 8266.884, 'duration': 6.582}, {'end': 8277.347, 'text': 'So then we will see that the message gets printed here.', 'start': 8273.466, 'duration': 3.881}, {'end': 8286.809, 'text': 'And usually what you want to keep this classes small, but you can write it like any other class.', 'start': 8278.427, 'duration': 8.382}, {'end': 8295.212, 'text': "So you can, for example, let's make a value to small error.", 'start': 8286.87, 'duration': 8.342}, {'end': 8302.584, 'text': 'And also, as a subclass, it has as a base class, it has the exception class.', 'start': 8297.222, 'duration': 5.362}], 'summary': 'Demonstrating catching and printing errors in a programming context.', 'duration': 35.7, 'max_score': 8266.884, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo8266884.jpg'}, {'end': 8416.504, 'src': 'embed', 'start': 8372.769, 'weight': 1, 'content': [{'end': 8380.674, 'text': 'So we can print E dot message, and we can also print E dot value.', 'start': 8372.769, 'duration': 7.905}, {'end': 8387.999, 'text': 'So if I test my function with one, then the value to small error will get raised.', 'start': 8381.375, 'duration': 6.624}, {'end': 8397.777, 'text': "So sorry, I'm missed the colon, I forgot the colon.", 'start': 8388.619, 'duration': 9.158}, {'end': 8408.601, 'text': 'So then it catches the error here and prints all the information that I defined here in my error class.', 'start': 8398.337, 'duration': 10.264}, {'end': 8416.504, 'text': 'Python already comes with a powerful bit in logging module.', 'start': 8413.243, 'duration': 3.261}], 'summary': 'Python can print e.message and e.value. testing with one raises small error. logging module is powerful.', 'duration': 43.735, 'max_score': 8372.769, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo8372769.jpg'}, {'end': 8503.63, 'src': 'embed', 'start': 8474.514, 'weight': 6, 'content': [{'end': 8482.8, 'text': 'And this is because by default, only levels of only messages with level warning or above are printed.', 'start': 8474.514, 'duration': 8.286}, {'end': 8489.38, 'text': 'And if you want to change this, we can do that by setting the basic configuration.', 'start': 8483.616, 'duration': 5.764}, {'end': 8494.944, 'text': 'And usually we want to do this right after importing the logging module.', 'start': 8490.241, 'duration': 4.703}, {'end': 8499.247, 'text': 'And then we say logging dot basic config.', 'start': 8495.624, 'duration': 3.623}, {'end': 8503.63, 'text': 'And then we can specify some arguments here.', 'start': 8500.027, 'duration': 3.603}], 'summary': 'By default, only warning messages and above are printed in the logging module.', 'duration': 29.116, 'max_score': 8474.514, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo8474514.jpg'}, {'end': 8771.905, 'src': 'embed', 'start': 8737.043, 'weight': 0, 'content': [{'end': 8747.47, 'text': "So now if I don't want to have this propagation, I can say logger dot propagate equals false.", 'start': 8737.043, 'duration': 10.427}, {'end': 8749.151, 'text': 'So by default, this is true.', 'start': 8747.55, 'duration': 1.601}, {'end': 8753.582, 'text': 'And now this will not propagate to the base logger.', 'start': 8749.901, 'duration': 3.681}, {'end': 8767.404, 'text': "And now for example, if I run this module and import the helper module, then nothing gets locked here because it doesn't propagate to our base logger.", 'start': 8754.342, 'duration': 13.062}, {'end': 8771.905, 'text': "Now let's talk about lock handlers.", 'start': 8769.424, 'duration': 2.481}], 'summary': 'Setting logger.propagate to false stops propagation to base logger.', 'duration': 34.862, 'max_score': 8737.043, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo8737043.jpg'}, {'end': 8968.841, 'src': 'embed', 'start': 8888.468, 'weight': 2, 'content': [{'end': 8893.01, 'text': 'And now we also specify some formatter.', 'start': 8888.468, 'duration': 4.542}, {'end': 8901.995, 'text': 'So we say a stream formatter equals logging dot formatter.', 'start': 8893.09, 'duration': 8.905}, {'end': 8911.849, 'text': 'And then inside here, we give it a string, just with the the same like with the basic config.', 'start': 8903.636, 'duration': 8.213}, {'end': 8917.512, 'text': "So let's say we want to have this string here.", 'start': 8913.23, 'duration': 4.282}, {'end': 8925.236, 'text': 'So we want to have the name of the logout and the level name and the message.', 'start': 8918.112, 'duration': 7.124}, {'end': 8935.541, 'text': "And let's also set the file handler to this formatter or just call this formatter.", 'start': 8926.116, 'duration': 9.425}, {'end': 8941.91, 'text': 'And then first, we set the formatter to our handler.', 'start': 8937.082, 'duration': 4.828}, {'end': 8949.455, 'text': 'So we say, stream handler, dot set formatter, formatter.', 'start': 8942.01, 'duration': 7.445}, {'end': 8957.3, 'text': 'And also we say file handler, dot set formatter, formatter.', 'start': 8950.416, 'duration': 6.884}, {'end': 8964.325, 'text': 'And then at the end, we have to add our handler to the logger.', 'start': 8958.601, 'duration': 5.724}, {'end': 8968.841, 'text': 'So we say logger dot add handler.', 'start': 8964.485, 'duration': 4.356}], 'summary': 'Configuring log formatter and handler for name, level, and message.', 'duration': 80.373, 'max_score': 8888.468, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo8888468.jpg'}, {'end': 9154.228, 'src': 'embed', 'start': 9113.14, 'weight': 5, 'content': [{'end': 9116.162, 'text': 'And then we can we define the console handler.', 'start': 9113.14, 'duration': 3.022}, {'end': 9120.626, 'text': 'And this is a stream handler with this formatter.', 'start': 9116.382, 'duration': 4.244}, {'end': 9125.13, 'text': 'And then we define this formatter and give it the format.', 'start': 9121.347, 'duration': 3.783}, {'end': 9140.262, 'text': 'And now if we want to use this config file, then in our file, we say, import logging dot config.', 'start': 9126.417, 'duration': 13.845}, {'end': 9150.947, 'text': 'And then we can call logging dot config dot file config, and then give it the file name.', 'start': 9141.163, 'duration': 9.784}, {'end': 9154.228, 'text': 'So we say logging dot conf.', 'start': 9151.007, 'duration': 3.221}], 'summary': 'Defining console and stream handlers, formatting, and using config file for logging.', 'duration': 41.088, 'max_score': 9113.14, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo9113140.jpg'}, {'end': 9297.442, 'src': 'embed', 'start': 9257.375, 'weight': 8, 'content': [{'end': 9260.939, 'text': "Now let's talk about capturing stack traces in your lock.", 'start': 9257.375, 'duration': 3.564}, {'end': 9264.782, 'text': 'So this can be very helpful for troubleshooting issues.', 'start': 9261.319, 'duration': 3.463}, {'end': 9272.57, 'text': "So let's say you have a, you run a code that raises an exception.", 'start': 9265.563, 'duration': 7.007}, {'end': 9280.598, 'text': "So let's say we have a list with some values 123.", 'start': 9272.63, 'duration': 7.968}, {'end': 9285.959, 'text': 'And we want to access a value, but we use an index that is too large.', 'start': 9280.598, 'duration': 5.361}, {'end': 9289.04, 'text': 'So this will raise a index error.', 'start': 9286.179, 'duration': 2.861}, {'end': 9297.442, 'text': 'And we can catch this by saying accept index error as E.', 'start': 9289.66, 'duration': 7.782}], 'summary': 'Capturing stack traces helps troubleshoot issues by catching specific errors, such as index errors.', 'duration': 40.067, 'max_score': 9257.375, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo9257375.jpg'}], 'start': 8145.229, 'title': 'Python exception and logging', 'summary': 'Introduces defining custom exceptions in python and covers python logging module, including different block levels, configuration options, and techniques for troubleshooting, with a demonstration of capturing stack traces and using rotating file handler.', 'chapters': [{'end': 8416.504, 'start': 8145.229, 'title': 'Defining custom exceptions in python', 'summary': 'Introduces how to define custom exceptions in python by subclassing from the base exception class, including examples of creating error classes and using try and except blocks with custom exceptions.', 'duration': 271.275, 'highlights': ['You can define own error classes by subclassing from the base exception class. The chapter explains that custom exceptions can be defined by subclassing from the base exception class, allowing for the creation of specific error classes.', "Example of creating a custom error class - 'value too high error', with a defined message and raising it based on a condition. An example of creating a custom error class 'value too high error' is demonstrated, including defining a message and raising the error based on a conditional statement.", 'Usage of try and except blocks with custom exceptions, and printing the error message and value when caught. The chapter illustrates the usage of try and except blocks with custom exceptions, along with printing the error message and value when caught.']}, {'end': 8598.61, 'start': 8416.604, 'title': 'Python logging tutorial', 'summary': 'Covers the usage of python logging module, including the different block levels, configuration options, and lock handlers, with a demonstration of capturing stack traces and using rotating file handler.', 'duration': 182.006, 'highlights': ['The different block levels are debug, info, warning, error, and critical, indicating the severity of the events, with only warning, error, and critical messages being printed by default. The different block levels in Python logging are debug, info, warning, error, and critical, and only messages with level warning or above are printed by default.', 'Basic configuration allows setting the level, format, and date format for logging, with the ability to specify different log record attributes such as name and ASC time. Basic configuration in Python logging allows setting the level, format, and date format, with the ability to specify log record attributes like name and ASC time.', 'The tutorial demonstrates how to specify the date format and different formatting rules for locking the time, including month, day, year, hour, minute, and second. The tutorial demonstrates specifying the date format and different formatting rules for locking the time, including month, day, year, hour, minute, and second.']}, {'end': 9255.755, 'start': 8599.791, 'title': 'Python logging: lockers, handlers, and configs', 'summary': 'Discusses the creation of custom loggers, the use of handlers to direct log messages, and the configuration of loggers using basic, file, and dict config methods.', 'duration': 655.964, 'highlights': ['Creation of custom loggers The chapter emphasizes the best practice of creating custom loggers for modules using the get_logger function and providing a unique name to create a hierarchy of loggers.', 'Usage of handlers to direct log messages It explains the use of different handlers like stream handler and file handler to direct log messages to specific destinations and demonstrates setting levels and formatters for each handler.', 'Configuration of loggers using basic, file, and dict config methods The chapter covers the basic, file, and dict config methods for configuring loggers, handlers, and formatters, providing a flexible way to define and change logging configurations without modifying code.']}, {'end': 9685.992, 'start': 9257.375, 'title': 'Logging and troubleshooting techniques', 'summary': 'Discusses capturing stack traces for troubleshooting issues, using rotating file handler to manage log files, and implementing timed rotating file handler to create log files based on time intervals.', 'duration': 428.617, 'highlights': ['Capturing stack traces for troubleshooting Explains how to catch exceptions, log error messages, and include stack traces for troubleshooting, providing practical examples.', 'Implementing rotating file handler Demonstrates the usage of rotating file handler to manage log files, specifying file size, rollover conditions, and backup counts, with a practical example.', 'Utilizing timed rotating file handler Illustrates the use of timed rotating file handler to create log files based on time intervals, specifying rollover conditions and providing a practical example.']}], 'duration': 1540.763, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo8145229.jpg', 'highlights': ['Custom exceptions can be defined by subclassing from the base exception class.', 'Different block levels in Python logging are debug, info, warning, error, and critical.', 'Basic configuration in Python logging allows setting the level, format, and date format.', 'The tutorial demonstrates specifying the date format and different formatting rules for locking the time.', 'Best practice of creating custom loggers for modules using the get_logger function.', 'Usage of handlers like stream handler and file handler to direct log messages to specific destinations.', 'The chapter covers the basic, file, and dict config methods for configuring loggers, handlers, and formatters.', 'Explains how to catch exceptions, log error messages, and include stack traces for troubleshooting.', 'Demonstrates the usage of rotating file handler to manage log files, specifying file size, rollover conditions, and backup counts.', 'Illustrates the use of timed rotating file handler to create log files based on time intervals.']}, {'end': 10766.541, 'segs': [{'end': 9842.489, 'src': 'embed', 'start': 9780.302, 'weight': 1, 'content': [{'end': 9786.545, 'text': 'And here we see that Jason data looks very similar to a dictionary.', 'start': 9780.302, 'duration': 6.243}, {'end': 9790.447, 'text': 'So it consists of several key value pairs.', 'start': 9787.165, 'duration': 3.282}, {'end': 9803.053, 'text': 'And as values, it can take strings or numbers or booleans, or also nested types like here a nested array or a nested dictionary.', 'start': 9791.387, 'duration': 11.666}, {'end': 9808.366, 'text': 'And we can also have a look at the whole conversion table.', 'start': 9804.504, 'duration': 3.862}, {'end': 9813.269, 'text': 'And by the way, you can find this on my website, python minus engineer.com.', 'start': 9808.866, 'duration': 4.403}, {'end': 9817.571, 'text': 'There you can find written tutorials to all my other video tutorials.', 'start': 9813.789, 'duration': 3.782}, {'end': 9822.633, 'text': 'And this is how Python is translated to Jason and vice versa.', 'start': 9818.491, 'duration': 4.142}, {'end': 9829.317, 'text': 'So a dictionary in Python is an object and Jason list and tuples are an array.', 'start': 9823.214, 'duration': 6.103}, {'end': 9832.403, 'text': 'A string is a string.', 'start': 9830.242, 'duration': 2.161}, {'end': 9835.805, 'text': 'integer, long and float are a number and Jason.', 'start': 9832.403, 'duration': 3.402}, {'end': 9842.489, 'text': 'true and false are also true and false, but with a lowercase, and none is null in Jason.', 'start': 9835.805, 'duration': 6.684}], 'summary': 'Python data can be similar to a dictionary, with key-value pairs and specific conversions to json, as detailed on python-engineer.com.', 'duration': 62.187, 'max_score': 9780.302, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo9780302.jpg'}, {'end': 9944.693, 'src': 'embed', 'start': 9911.516, 'weight': 3, 'content': [{'end': 9916.899, 'text': 'So this will dump our object to a JSON string.', 'start': 9911.516, 'duration': 5.383}, {'end': 9925.043, 'text': 'Now if I print this, print our person in JSON, then I will see that this is now in JSON format.', 'start': 9917.359, 'duration': 7.684}, {'end': 9929.265, 'text': 'And we can see this, for example, because false has a lowercase.', 'start': 9925.143, 'duration': 4.122}, {'end': 9937.067, 'text': 'Now I can also specify an indent here and I would recommend setting this indent to four.', 'start': 9930.345, 'duration': 6.722}, {'end': 9940.17, 'text': 'And now this has a nicer format.', 'start': 9937.808, 'duration': 2.362}, {'end': 9944.693, 'text': 'I can also specify different separators.', 'start': 9941.551, 'duration': 3.142}], 'summary': 'Object dumped to json string with recommended indent of four, allowing for a nicer format.', 'duration': 33.177, 'max_score': 9911.516, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo9911516.jpg'}, {'end': 10444.532, 'src': 'embed', 'start': 10406.941, 'weight': 0, 'content': [{'end': 10412.215, 'text': 'And now here, I use this encode user function.', 'start': 10406.941, 'duration': 5.274}, {'end': 10418.66, 'text': 'So this now will use this function for how to encode the object.', 'start': 10412.835, 'duration': 5.825}, {'end': 10422.122, 'text': 'And now if I run this, then this work.', 'start': 10419.38, 'duration': 2.742}, {'end': 10426.225, 'text': 'So now I can print our user dot JSON.', 'start': 10422.262, 'duration': 3.963}, {'end': 10437.053, 'text': 'And now we see that we have our dictionary with the name, the age and the user class is key with the value true.', 'start': 10427.006, 'duration': 10.047}, {'end': 10444.532, 'text': 'So this is how you encode a custom object with this default argument.', 'start': 10438.308, 'duration': 6.224}], 'summary': 'Using encode user function to encode custom object with default argument.', 'duration': 37.591, 'max_score': 10406.941, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo10406941.jpg'}], 'start': 9686.712, 'title': 'Python json logging and conversion', 'summary': 'Covers python json logging for microservices, python to json conversion, and custom object encoding and decoding, with practical code examples and detailed explanation of the processes.', 'chapters': [{'end': 9973.036, 'start': 9686.712, 'title': 'Using python json logger for microservices', 'summary': "Discusses the use of json format for logging in a microservice architecture, recommending the open source python json logger available on github and explaining the process of encoding and decoding json data using python's built-in json module.", 'duration': 286.324, 'highlights': ['The chapter discusses the use of JSON format for logging in a microservice architecture, recommending the open source Python JSON logger available on GitHub. It is recommended to use the JSON format for logging in a microservice architecture and to use the open source Python JSON logger available on GitHub for this purpose.', "The process of encoding and decoding JSON data using Python's built-in JSON module is explained, including the use of JSON.dump() and JSON.dumps() methods for serialization. The chapter explains the process of encoding and decoding JSON data using Python's built-in JSON module, including the use of JSON.dump() and JSON.dumps() methods for serialization."]}, {'end': 10282.125, 'start': 9973.036, 'title': 'Python to json conversion', 'summary': 'Explains how to convert python dictionaries and custom objects to json objects, demonstrating the conversion process and the use of load and dump methods through practical code examples.', 'duration': 309.089, 'highlights': ['To convert a Python dictionary to a JSON object, use the json.dump method to dump the dictionary into a file, specifying the indent for a nicer format, and json.dumps method to dump it into a string.', 'The process of decoding JSON data, whether from a string or a file, back into a Python object is illustrated using the json.load method, effectively converting the JSON string or file back into a Python dictionary or custom object.', 'Demonstrates the serialization error when attempting to dump a custom object directly into a JSON string, highlighting the need for custom serialization methods for non-serializable objects.']}, {'end': 10766.541, 'start': 10283.047, 'title': 'Custom object encoding and decoding', 'summary': 'Explains how to write a custom encoding function to encode a custom object to json format, then implement a custom json encoder and a custom decoding method to convert the json object back to the original form, showcasing how to use these methods with detailed examples and results.', 'duration': 483.494, 'highlights': ['The chapter explains how to create a custom encoding function to encode a custom object to a JSON format, with detailed steps and examples. It details the process of creating a custom encoding function, including checking if the object is of a specific class, returning a dictionary with instance variables as key-value pairs, and dealing with class name and type errors.', 'It demonstrates the implementation of a custom JSON encoder to encode the object in JSON format, providing a step-by-step guide and practical demonstration. The chapter showcases how to create a custom JSON encoder class, override the default method, and use it to encode the object, with a comparison to the base JSON encoder and practical execution results.', 'The chapter presents a custom decoding method to convert the JSON object back to the original form, explaining the process and providing a detailed example. It details the creation of a custom decoding method, including checking for the presence of the user key in the dictionary, returning a user object with name and age attributes, and specifying the object hook in the JSON load method, with a demonstration of the decoding process and the resulting object type.']}], 'duration': 1079.829, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo9686712.jpg', 'highlights': ['The chapter discusses the use of JSON format for logging in a microservice architecture, recommending the open source Python JSON logger available on GitHub.', "The process of encoding and decoding JSON data using Python's built-in JSON module is explained, including the use of JSON.dump() and JSON.dumps() methods for serialization.", 'To convert a Python dictionary to a JSON object, use the json.dump method to dump the dictionary into a file, specifying the indent for a nicer format, and json.dumps method to dump it into a string.', 'The process of decoding JSON data, whether from a string or a file, back into a Python object is illustrated using the json.load method, effectively converting the JSON string or file back into a Python dictionary or custom object.', 'Demonstrates the serialization error when attempting to dump a custom object directly into a JSON string, highlighting the need for custom serialization methods for non-serializable objects.', 'The chapter explains how to create a custom encoding function to encode a custom object to a JSON format, with detailed steps and examples.', 'It demonstrates the implementation of a custom JSON encoder to encode the object in JSON format, providing a step-by-step guide and practical demonstration.', 'The chapter presents a custom decoding method to convert the JSON object back to the original form, explaining the process and providing a detailed example.']}, {'end': 11606.693, 'segs': [{'end': 10794.55, 'src': 'embed', 'start': 10768.061, 'weight': 0, 'content': [{'end': 10778.12, 'text': 'And then we see that this is now of class user, and we can access its instance variables, for example, user dot name, and here it prints max.', 'start': 10768.061, 'duration': 10.059}, {'end': 10781.222, 'text': 'So this is how you decode custom objects.', 'start': 10778.76, 'duration': 2.462}, {'end': 10789.126, 'text': 'So Python comes with different built in modules to generate random numbers.', 'start': 10785.344, 'duration': 3.782}, {'end': 10794.55, 'text': 'In this tutorial we will have a look at the random module for pseudo random numbers,', 'start': 10789.807, 'duration': 4.743}], 'summary': 'Python tutorial covers decoding custom objects and using random module for pseudo random numbers.', 'duration': 26.489, 'max_score': 10768.061, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo10768061.jpg'}, {'end': 10884.403, 'src': 'embed', 'start': 10849.383, 'weight': 1, 'content': [{'end': 10858.53, 'text': 'Now if you want to have a specific range, we can use random that dot uniform and give it a start and a stop.', 'start': 10849.383, 'duration': 9.147}, {'end': 10863.735, 'text': "So let's say our range is from one to 10.", 'start': 10858.651, 'duration': 5.084}, {'end': 10867.338, 'text': 'Now this will produce a random float in this range.', 'start': 10863.735, 'duration': 3.603}, {'end': 10876.145, 'text': 'Now if you want to have integers, we can use random dot rant int and give it the range.', 'start': 10869.099, 'duration': 7.046}, {'end': 10884.403, 'text': "And if we run this a couple of times, now it's not happening.", 'start': 10877.239, 'duration': 7.164}], 'summary': 'Using random.uniform for float and random.randint for integers in a range from 1 to 10.', 'duration': 35.02, 'max_score': 10849.383, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo10849383.jpg'}, {'end': 11018.222, 'src': 'embed', 'start': 10980.731, 'weight': 5, 'content': [{'end': 10985.712, 'text': "So let's say we have a list and call it my list equals.", 'start': 10980.731, 'duration': 4.981}, {'end': 10991.967, 'text': "And let's create a list with different characters.", 'start': 10987.073, 'duration': 4.894}, {'end': 11001.313, 'text': 'So if we print this, we will see that each character is now an element in our list.', 'start': 10992.788, 'duration': 8.525}, {'end': 11005.255, 'text': 'And for example, now we can pick a random choice.', 'start': 11002.113, 'duration': 3.142}, {'end': 11012.859, 'text': "So let's say a equals random dot choice from our list.", 'start': 11005.335, 'duration': 7.524}, {'end': 11015.981, 'text': 'And print this.', 'start': 11015.02, 'duration': 0.961}, {'end': 11018.222, 'text': 'So this will pick a random element.', 'start': 11016.041, 'duration': 2.181}], 'summary': 'Python code creates a list of characters and picks a random element.', 'duration': 37.491, 'max_score': 10980.731, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo10980731.jpg'}, {'end': 11098.464, 'src': 'embed', 'start': 11062.586, 'weight': 2, 'content': [{'end': 11065.867, 'text': 'So this will do the same thing.', 'start': 11062.586, 'duration': 3.281}, {'end': 11069.349, 'text': 'But now we see it can pick elements multiple times.', 'start': 11065.927, 'duration': 3.422}, {'end': 11074.611, 'text': "Then there's also the random shuffle methods.", 'start': 11071.65, 'duration': 2.961}, {'end': 11081.619, 'text': "So let's say random dot shuffle our list.", 'start': 11074.931, 'duration': 6.688}, {'end': 11085.36, 'text': 'So this will shuffle a list in place.', 'start': 11082.139, 'duration': 3.221}, {'end': 11090.821, 'text': 'Now if we print this, then we see that the elements are now shuffled.', 'start': 11085.38, 'duration': 5.441}, {'end': 11098.464, 'text': 'So these are the most common functions to generate random numbers.', 'start': 11092.862, 'duration': 5.602}], 'summary': 'Demonstrating multiple random element selection and list shuffling functions.', 'duration': 35.878, 'max_score': 11062.586, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo11062586.jpg'}], 'start': 10768.061, 'title': 'Python random module and number generation', 'summary': "Covers the usage of python's random module for generating pseudo-random numbers, including functions such as random(), uniform(), randint(), normalvariate(), choice(), sample(), choices(), and shuffle(). it also explores reproducible random number generation using seed functions and introduces the numpy module for working with arrays.", 'chapters': [{'end': 11198.686, 'start': 10768.061, 'title': 'Python random module overview', 'summary': "Explains the usage of python's random module for generating pseudo-random numbers, including functions such as random(), uniform(), randint(), normalvariate(), choice(), sample(), choices(), and shuffle(). it also demonstrates reproducibility using the seed method.", 'duration': 430.625, 'highlights': ['The random module in Python is used to generate pseudo-random numbers for various distributions, including functions like random(), uniform(), randint(), normalvariate(), choice(), sample(), choices(), and shuffle() for different use cases and distributions.', 'The random() function in Python generates a random float in the range from 0 to 1, while the uniform() function produces a random float within a specific range, and the randint() function generates random integers within a given range, with options for inclusive or exclusive behavior.', 'The normalvariate() function can be utilized for working with statistical data, as it picks a random value from a normal distribution with a specified mean and standard deviation, while the choice(), sample(), and choices() functions cater to different selection requirements, including unique or multiple element selection.', 'The reproducibility of pseudo-random numbers in Python can be achieved using the seed() method, allowing for the generation of the same random numbers with a specific seed value, thus ensuring predictability and reproducibility of results.']}, {'end': 11606.693, 'start': 11199.587, 'title': 'Random number generation in python', 'summary': 'Discusses reproducible random number generation using seed functions, recommends the use of the secrets module for security purposes, and introduces the numpy module for working with arrays, providing examples of functions and their output.', 'duration': 407.106, 'highlights': ['The chapter discusses reproducible random number generation using seed functions The transcript explains how to reproduce data using random seed functions, ensuring that all operations with a seed of one produce the same results.', 'Recommends the use of the secrets module for security purposes The secrets module is recommended for security purposes, with only three functions for use in situations such as passwords, security tokens, or account authentication.', 'Introduces the numpy module for working with arrays, providing examples of functions and their output The transcript introduces the numpy module for working with arrays, providing examples of generating random floats and integers, creating arrays with various dimensions, and shuffling elements.']}], 'duration': 838.632, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo10768061.jpg', 'highlights': ['The random module in Python is used to generate pseudo-random numbers for various distributions, including functions like random(), uniform(), randint(), normalvariate(), choice(), sample(), choices(), and shuffle() for different use cases and distributions.', 'The reproducibility of pseudo-random numbers in Python can be achieved using the seed() method, allowing for the generation of the same random numbers with a specific seed value, thus ensuring predictability and reproducibility of results.', 'The normalvariate() function can be utilized for working with statistical data, as it picks a random value from a normal distribution with a specified mean and standard deviation, while the choice(), sample(), and choices() functions cater to different selection requirements, including unique or multiple element selection.', 'The random() function in Python generates a random float in the range from 0 to 1, while the uniform() function produces a random float within a specific range, and the randint() function generates random integers within a given range, with options for inclusive or exclusive behavior.', 'The chapter discusses reproducible random number generation using seed functions The transcript explains how to reproduce data using random seed functions, ensuring that all operations with a seed of one produce the same results.', 'Introduces the numpy module for working with arrays, providing examples of functions and their output The transcript introduces the numpy module for working with arrays, providing examples of generating random floats and integers, creating arrays with various dimensions, and shuffling elements.', 'Recommends the use of the secrets module for security purposes The secrets module is recommended for security purposes, with only three functions for use in situations such as passwords, security tokens, or account authentication.']}, {'end': 12910.79, 'segs': [{'end': 11672.18, 'src': 'embed', 'start': 11648.297, 'weight': 1, 'content': [{'end': 11658.904, 'text': "And the important thing is that you should use the numpy random seed method instead of the seed method from the random module that we've seen previously.", 'start': 11648.297, 'duration': 10.607}, {'end': 11662.567, 'text': 'So these are two completely different seed generators.', 'start': 11659.365, 'duration': 3.202}, {'end': 11672.18, 'text': 'Decorators are a very powerful tool in Python and every advanced Python programmer should know it.', 'start': 11667.096, 'duration': 5.084}], 'summary': 'Use numpy random seed, not random seed. decorators are essential in python.', 'duration': 23.883, 'max_score': 11648.297, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo11648297.jpg'}, {'end': 11872.443, 'src': 'embed', 'start': 11796.583, 'weight': 0, 'content': [{'end': 11800.385, 'text': 'And this will simply print Alex.', 'start': 11796.583, 'duration': 3.802}, {'end': 11809.032, 'text': 'And then we have a decorator function, call it start and decorator.', 'start': 11801.847, 'duration': 7.185}, {'end': 11813.477, 'text': 'And now as an argument, it takes a function.', 'start': 11809.935, 'duration': 3.542}, {'end': 11822.003, 'text': 'And inside our decorator function, we have an inner function called and we call it wrapper.', 'start': 11815.259, 'duration': 6.744}, {'end': 11829.648, 'text': 'So def wrapper, this is a wrapper function, which, which wraps our function.', 'start': 11822.564, 'duration': 7.084}, {'end': 11836.453, 'text': 'So he inside this wrapper function, we execute the function.', 'start': 11830.449, 'duration': 6.004}, {'end': 11841.181, 'text': 'And then as I said, I can extend the behavior.', 'start': 11837.614, 'duration': 3.567}, {'end': 11846.164, 'text': 'So I can do something before and I can do something after it.', 'start': 11841.682, 'duration': 4.482}, {'end': 11860.772, 'text': 'So before I say in this case simply print, start and after it I want to print and and then, after creating this inner wrapper function,', 'start': 11846.765, 'duration': 14.007}, {'end': 11862.553, 'text': 'I also have to return it.', 'start': 11860.772, 'duration': 1.781}, {'end': 11872.443, 'text': "And now to apply this, let's first of all, simply let's execute the print name function.", 'start': 11864.815, 'duration': 7.628}], 'summary': 'Decorator function extends behavior before and after executing a function.', 'duration': 75.86, 'max_score': 11796.583, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo11796583.jpg'}, {'end': 12663.776, 'src': 'embed', 'start': 12625.622, 'weight': 4, 'content': [{'end': 12631.704, 'text': 'Hello, and I want to decorate this with a class decorator.', 'start': 12625.622, 'duration': 6.082}, {'end': 12634.065, 'text': 'And I call this count calls.', 'start': 12631.864, 'duration': 2.201}, {'end': 12646.428, 'text': 'So class decorators do the same thing as function decorators, but they are typically used if we want to maintain and update a state.', 'start': 12635.125, 'duration': 11.303}, {'end': 12654.252, 'text': 'So in this example, I want to keep track of how many times I have executed this function.', 'start': 12647.089, 'duration': 7.163}, {'end': 12659.554, 'text': "So let's create a class, call it count calls.", 'start': 12654.992, 'duration': 4.562}, {'end': 12663.776, 'text': 'And this has a init method.', 'start': 12660.755, 'duration': 3.021}], 'summary': 'Using a class decorator to track function executions, maintaining and updating a state.', 'duration': 38.154, 'max_score': 12625.622, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo12625622.jpg'}], 'start': 11609.068, 'title': 'Python decorators and syntax', 'summary': 'Covers python decorators, including syntax, functionality, and application, showcasing how to extend function behavior and preserve function information, and explores nested decorators, class decorators, use cases, and examples.', 'chapters': [{'end': 11937.492, 'start': 11609.068, 'title': 'Python decorators: extending functionality', 'summary': 'Covers the concept of decorators in python, including the syntax, functionality, and application of function decorators, with a demonstration of extending the behavior of a function using a decorator.', 'duration': 328.424, 'highlights': ['The chapter explains the concept of decorators in Python, including the syntax, functionality, and application of function decorators. It provides an in-depth understanding of decorators in Python, covering their syntax, functionality, and application.', 'Demonstration of extending the behavior of a function using a decorator, with a step-by-step explanation and example. It includes a step-by-step demonstration of extending the behavior of a function using a decorator, along with a detailed example.', 'Emphasizes the importance of using the numpy random seed method over the seed method from the random module for reproducing the same array. It highlights the importance of using the numpy random seed method for reproducing the same array and emphasizes its superiority over the seed method from the random module.']}, {'end': 12264.895, 'start': 11939.294, 'title': 'Python decorator syntax', 'summary': 'Explains python decorator syntax, covering function arguments, return values, function identity, and decorator templates, showcasing how to fix errors and preserve function information using functools and decorators.', 'duration': 325.601, 'highlights': ['The chapter explains how to fix type error by using *args and **kwargs to allow multiple arguments and keyword arguments in a function, demonstrating the fix for the error when providing an argument to the function. It also details the process of preserving function information using functools and decorators.', "The transcript provides a detailed explanation of how to fix the issue of returning 'None' by saving the result of the function and returning it from the inner wrapper function, showcasing the fix for the issue when printing the result of a function.", "It also covers the process of preserving function information by using the functools library and applying the functools.wraps decorator to maintain the original function's metadata, demonstrating how to resolve confusion about the function's identity.", 'The chapter presents a template for creating a decorator, illustrating the step-by-step process of creating a decorator that performs actions before and after executing a function and returns the wrapper, showcasing the creation of a custom decorator.']}, {'end': 12910.79, 'start': 12265.795, 'title': 'Decorators and nested decorators', 'summary': 'Explores the concept of decorators with arguments, nested decorators, and class decorators, providing examples and use cases, including applying multiple decorators to a function and implementing a class decorator to maintain and update a state.', 'duration': 644.995, 'highlights': ['The chapter explains the concept of decorators with arguments, demonstrating how to create a decorator that executes a function a specific number of times using the repeat decorator. The example shows executing the greet function four times using the repeat decorator with the argument num times set to three.', 'The transcript discusses applying multiple decorators to a function, explaining how decorators are executed in the order they are listed and providing an example of applying a start and debug decorator to the say hello function, along with the sequence of execution and printed information.', 'It explores class decorators, illustrating how to define and use a class decorator to maintain and update a state, with an example of a count calls class decorator keeping track of how many times a function has been executed and providing the execution count when the function is called.']}], 'duration': 1301.722, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo11609068.jpg', 'highlights': ['Covers python decorators, including syntax, functionality, and application', 'Demonstration of extending the behavior of a function using a decorator', 'Emphasizes the importance of using the numpy random seed method for reproducing the same array', 'Explains how to fix type error by using *args and **kwargs to allow multiple arguments and keyword arguments in a function', 'Details the process of preserving function information using functools and decorators', "Explains how to fix the issue of returning 'None' by saving the result of the function and returning it from the inner wrapper function", 'Covers the process of preserving function information by using the functools library and applying the functools.wraps decorator', 'Presents a template for creating a decorator, illustrating the step-by-step process of creating a decorator that performs actions before and after executing a function and returns the wrapper', 'Explains the concept of decorators with arguments, demonstrating how to create a decorator that executes a function a specific number of times using the repeat decorator', 'Discusses applying multiple decorators to a function, explaining how decorators are executed in the order they are listed', 'Explores class decorators, illustrating how to define and use a class decorator to maintain and update a state']}, {'end': 13961.252, 'segs': [{'end': 13054.142, 'src': 'embed', 'start': 13018.849, 'weight': 2, 'content': [{'end': 13024.933, 'text': 'So I can say for I in G, and then I print the value.', 'start': 13018.849, 'duration': 6.084}, {'end': 13028.156, 'text': 'So this will print one, two, and three.', 'start': 13025.574, 'duration': 2.582}, {'end': 13034.01, 'text': 'And I can also get the values one at a time with the next function.', 'start': 13029.147, 'duration': 4.863}, {'end': 13041.334, 'text': 'So I can say value equals next g.', 'start': 13034.59, 'duration': 6.744}, {'end': 13043.956, 'text': 'And then I can print the value.', 'start': 13041.334, 'duration': 2.622}, {'end': 13046.637, 'text': 'So this will print one.', 'start': 13045.337, 'duration': 1.3}, {'end': 13054.142, 'text': 'And this will execute the function and drums until until it reaches the first yield statement.', 'start': 13047.338, 'duration': 6.804}], 'summary': 'Using the next function in python, i printed values 1, 2, and 3 from a generator.', 'duration': 35.293, 'max_score': 13018.849, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo13018849.jpg'}, {'end': 13147.29, 'src': 'embed', 'start': 13113.739, 'weight': 0, 'content': [{'end': 13119.842, 'text': 'And you can also, for example, use them as inputs to other functions that take iterables.', 'start': 13113.739, 'duration': 6.103}, {'end': 13125.646, 'text': 'So for example, the built in some function takes a iterable.', 'start': 13120.643, 'duration': 5.003}, {'end': 13130.549, 'text': 'So I can give the generator object here and I can print this.', 'start': 13125.746, 'duration': 4.803}, {'end': 13137.473, 'text': 'So this will calculate one plus two plus three equals six.', 'start': 13131.629, 'duration': 5.844}, {'end': 13147.29, 'text': 'or I can, for example, use the built in sorted method and put the generator object here.', 'start': 13138.707, 'duration': 8.583}], 'summary': 'Generator objects can be used as inputs to functions like some and sorted, providing flexibility in calculations.', 'duration': 33.551, 'max_score': 13113.739, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo13113739.jpg'}, {'end': 13353.402, 'src': 'embed', 'start': 13323.751, 'weight': 4, 'content': [{'end': 13329.995, 'text': 'And then again, it remembers the state and the next time I continue, it will continue from here, and so on.', 'start': 13323.751, 'duration': 6.244}, {'end': 13340.828, 'text': 'And again, if I run this a couple of times, again, if I print next, and it will also print two, and now it will also print one.', 'start': 13330.716, 'duration': 10.112}, {'end': 13344.431, 'text': 'And now it will raise the stop iteration.', 'start': 13340.848, 'duration': 3.583}, {'end': 13347.454, 'text': 'So this is the execution.', 'start': 13345.672, 'duration': 1.782}, {'end': 13348.92, 'text': 'in detail.', 'start': 13348.18, 'duration': 0.74}, {'end': 13353.402, 'text': "And now let's have a look at the big advantage of generators.", 'start': 13349.681, 'duration': 3.721}], 'summary': 'Generator remembers state, runs multiple times, and raises stop iteration.', 'duration': 29.651, 'max_score': 13323.751, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo13323751.jpg'}, {'end': 13520.407, 'src': 'embed', 'start': 13483.284, 'weight': 7, 'content': [{'end': 13485.105, 'text': 'So this takes a lot of memory.', 'start': 13483.284, 'duration': 1.821}, {'end': 13497.426, 'text': 'And now if I use a generator instead, I can say I define another function first n underscore Jenna rater.', 'start': 13485.806, 'duration': 11.62}, {'end': 13501.429, 'text': 'And now it also takes n as input.', 'start': 13497.446, 'duration': 3.983}, {'end': 13504.772, 'text': "And now I don't need the list anymore.", 'start': 13502.37, 'duration': 2.402}, {'end': 13513.539, 'text': 'And I simply say num equals zero and also the while loop while num is smaller than n.', 'start': 13504.792, 'duration': 8.747}, {'end': 13518.886, 'text': 'And here I simply yield the current number.', 'start': 13513.539, 'duration': 5.347}, {'end': 13520.407, 'text': 'So I yield num.', 'start': 13519.046, 'duration': 1.361}], 'summary': 'Using a generator reduces memory usage by eliminating the need for a list, yielding the current number in a while loop.', 'duration': 37.123, 'max_score': 13483.284, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo13483284.jpg'}, {'end': 13870.708, 'src': 'embed', 'start': 13827.053, 'weight': 1, 'content': [{'end': 13836.733, 'text': 'So generator expressions are written the same way, like list comprehensions, but with parentheses instead of square brackets.', 'start': 13827.053, 'duration': 9.68}, {'end': 13847.915, 'text': 'And this is a very simple syntax and shortcut to generate some generate to implement the generator expression.', 'start': 13837.473, 'duration': 10.442}, {'end': 13861.758, 'text': 'So I can say my generator equals and now I use parentheses and here I can use an expression with a for in loop.', 'start': 13848.855, 'duration': 12.903}, {'end': 13870.708, 'text': 'So I can say I for i in range, for example, 10.', 'start': 13862.319, 'duration': 8.389}], 'summary': 'Generator expressions use parentheses, provide a simple syntax for creating generators.', 'duration': 43.655, 'max_score': 13827.053, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo13827053.jpg'}], 'start': 12911.591, 'title': 'Python generators and decorators', 'summary': 'Covers python decorators to modify function behavior, register functions, and cache return values. it also explains the memory efficiency of generators and their advantages over lists, demonstrated through examples and quantifiable data.', 'chapters': [{'end': 12959.917, 'start': 12911.591, 'title': 'Python decorators and generators', 'summary': 'Explains how to use decorators to modify function behavior, register functions like plugins, and cache return values. it also discusses the memory efficiency of generators, highlighting that they generate items lazily and are more memory efficient when dealing with large data sets.', 'duration': 48.326, 'highlights': ['Generators generate items inside the object lazily, making them more memory efficient when dealing with large data sets.', 'Decorators can be used to modify function behavior, register functions like plugins, and cache return values.', 'Generators are functions that return an object that can be iterated over, generating items only one at a time and only when asked for.']}, {'end': 13596.827, 'start': 12960.118, 'title': 'Understanding generators in python', 'summary': 'Explains generators in python, including their syntax and usage, the execution of generator functions, and the memory efficiency advantage of using generators over lists, demonstrated through examples and quantifiable data.', 'duration': 636.709, 'highlights': ['The execution of generator functions is detailed, including the syntax, usage, and the behavior of the next function and stop iteration, demonstrated through multiple examples and code snippets.', 'The memory efficiency advantage of generators over lists is explained through examples, comparing the memory usage of a list with a generator using sys.getsizeof, demonstrating the quantifiable memory savings.', 'Generators in Python are explained, including their syntax, usage, and advantages, such as being memory efficient and suitable for working with large data sets, demonstrated through code examples and quantifiable data.']}, {'end': 13961.252, 'start': 13597.567, 'title': 'Generator objects and expressions', 'summary': 'Explains the advantages of generator objects, including their memory efficiency and ability to generate elements on the fly, and demonstrates their usage with examples like the fibonacci sequence and generator expressions.', 'duration': 363.685, 'highlights': ['Generator objects are memory efficient, particularly when dealing with large datasets, as they take up less memory compared to regular lists. The generator object is smaller, making it more memory efficient, especially when dealing with large datasets like 1 million numbers.', 'Generator objects allow for the generation of elements on the fly, enabling the retrieval of the first item without calculating all the numbers, thus providing a significant advantage. Generator objects enable the retrieval of the first item without calculating all the numbers, providing a significant advantage in generating elements on the fly.', 'The Fibonacci sequence is implemented as a generator, allowing the generation of the sequence up to a specified limit and its iteration over a loop. The Fibonacci sequence is implemented as a generator, allowing the generation of the sequence up to a specified limit and its iteration over a loop.', 'Generator expressions, written with parentheses, provide a simple syntax and shortcut to generate elements, similar to list comprehensions. Generator expressions, written with parentheses, provide a simple syntax and shortcut to generate elements, similar to list comprehensions.']}], 'duration': 1049.661, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo12911591.jpg', 'highlights': ['Generators are functions that return an object that can be iterated over, generating items only one at a time and only when asked for.', 'Decorators can be used to modify function behavior, register functions like plugins, and cache return values.', 'Generators generate items inside the object lazily, making them more memory efficient when dealing with large data sets.', 'The memory efficiency advantage of generators over lists is explained through examples, comparing the memory usage of a list with a generator using sys.getsizeof, demonstrating the quantifiable memory savings.', 'Generator objects are memory efficient, particularly when dealing with large datasets, as they take up less memory compared to regular lists. The generator object is smaller, making it more memory efficient, especially when dealing with large datasets like 1 million numbers.', 'Generator objects allow for the generation of elements on the fly, enabling the retrieval of the first item without calculating all the numbers, thus providing a significant advantage. Generator objects enable the retrieval of the first item without calculating all the numbers, providing a significant advantage in generating elements on the fly.', 'The Fibonacci sequence is implemented as a generator, allowing the generation of the sequence up to a specified limit and its iteration over a loop. The Fibonacci sequence is implemented as a generator, allowing the generation of the sequence up to a specified limit and its iteration over a loop.', 'Generator expressions, written with parentheses, provide a simple syntax and shortcut to generate elements, similar to list comprehensions.', 'The execution of generator functions is detailed, including the syntax, usage, and the behavior of the next function and stop iteration, demonstrated through multiple examples and code snippets.', 'Generators in Python are explained, including their syntax, usage, and advantages, such as being memory efficient and suitable for working with large data sets, demonstrated through code examples and quantifiable data.']}, {'end': 15528.832, 'segs': [{'end': 14727.939, 'src': 'embed', 'start': 14693.667, 'weight': 5, 'content': [{'end': 14696.208, 'text': 'So here I can filter for processes.', 'start': 14693.667, 'duration': 2.541}, {'end': 14700.01, 'text': 'So I say, I filter for Python.', 'start': 14696.308, 'duration': 3.702}, {'end': 14709.099, 'text': "And I, you can see that I've already two Python processes running, they all have a different process ID.", 'start': 14700.19, 'duration': 8.909}, {'end': 14715.963, 'text': "And they all it's also shown how many threads are inside my process.", 'start': 14710.059, 'duration': 5.904}, {'end': 14723.909, 'text': "So now if I'm executing this Python file, then we will see what will happen.", 'start': 14716.764, 'duration': 7.145}, {'end': 14727.939, 'text': 'So it takes a couple of seconds.', 'start': 14726.038, 'duration': 1.901}], 'summary': 'Filtering processes for python, found 2 with different ids and thread counts.', 'duration': 34.272, 'max_score': 14693.667, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo14693667.jpg'}, {'end': 14848.675, 'src': 'embed', 'start': 14810.916, 'weight': 0, 'content': [{'end': 14815.657, 'text': 'And if my target has some arguments, then I would also have to specify the arcs here.', 'start': 14810.916, 'duration': 4.741}, {'end': 14826.06, 'text': 'And then I say, threats dot append my threat, then I will start each threat.', 'start': 14816.557, 'duration': 9.503}, {'end': 14834.902, 'text': 'So I will say for T in threats, T dot start, and also join them.', 'start': 14826.1, 'duration': 8.802}, {'end': 14842.049, 'text': 'So I will say for T in threads, T dot join.', 'start': 14835.002, 'duration': 7.047}, {'end': 14848.675, 'text': "And now let's have a look at the activity manager again.", 'start': 14843.23, 'duration': 5.445}], 'summary': 'Using python, append and start threats, then join them in the activity manager.', 'duration': 37.759, 'max_score': 14810.916, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo14810916.jpg'}, {'end': 15189.098, 'src': 'embed', 'start': 15145.286, 'weight': 1, 'content': [{'end': 15151.011, 'text': 'So we import time, and then we wait some time here.', 'start': 15145.286, 'duration': 5.725}, {'end': 15156.047, 'text': 'So we say time dot sleep 0.1.', 'start': 15151.071, 'duration': 4.976}, {'end': 15161.67, 'text': 'And then when we are done, we want to write our new value back into our database.', 'start': 15156.047, 'duration': 5.623}, {'end': 15167.934, 'text': 'So we simply copy it back and say database value equals local copy.', 'start': 15161.71, 'duration': 6.224}, {'end': 15172.216, 'text': 'So this is our increase function.', 'start': 15168.634, 'duration': 3.582}, {'end': 15176.018, 'text': "And now let's run this.", 'start': 15173.957, 'duration': 2.061}, {'end': 15179.1, 'text': 'So now we have two threads.', 'start': 15176.138, 'duration': 2.962}, {'end': 15186.117, 'text': "And if we run this, let's clear our console.", 'start': 15180.16, 'duration': 5.957}, {'end': 15189.098, 'text': "Let's run this again.", 'start': 15188.038, 'duration': 1.06}], 'summary': 'Code imports time, waits 0.1 sec, updates database, and runs two threads.', 'duration': 43.812, 'max_score': 15145.286, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo15145286.jpg'}, {'end': 15314.456, 'src': 'embed', 'start': 15282.765, 'weight': 2, 'content': [{'end': 15289.977, 'text': 'So now threats to also has a local copy which is zero, and then it increases it to one.', 'start': 15282.765, 'duration': 7.212}, {'end': 15295.68, 'text': 'And then we again say time dot sleep, so we can switch back to thread number one.', 'start': 15290.737, 'duration': 4.943}, {'end': 15304.084, 'text': "And now thread number one copies its its local copy that is one into our database, and then it's done.", 'start': 15295.7, 'duration': 8.384}, {'end': 15314.456, 'text': 'And then we are switch back to thread two again, and that now also copies its local copy that to see also one here into the database value.', 'start': 15304.385, 'duration': 10.071}], 'summary': 'Threads create local copies, increase to one, and update database values.', 'duration': 31.691, 'max_score': 15282.765, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo15282765.jpg'}], 'start': 13962.253, 'title': 'Python threading and multiprocessing', 'summary': "Explains the difference between threading and multiprocessing, discusses python's global interpreter lock (gil), demonstrates the usage of python's threading module for creating and managing threads, and highlights the use of locks to prevent race conditions in multithreading, with examples of handling large data and expensive computations.", 'chapters': [{'end': 14290.437, 'start': 13962.253, 'title': 'Threading vs. multiprocessing', 'summary': 'Explains the difference between processes and threads, emphasizing that processes are advantageous for cpu-bound tasks and multi-threading is beneficial for io-bound tasks, with multiprocessing being able to handle large amounts of data and expensive computations, while highlighting the limitations of threading due to the global interpreter lock (gil).', 'duration': 328.184, 'highlights': ['Processes are advantageous for CPU-bound tasks and multi-threading is beneficial for IO-bound tasks Processes take advantage of multiple CPUs and cores and are great for CPU-bound processing, while threading is great for IO-bound tasks such as talking to slow devices like a hard drive or a network connection.', 'Multiprocessing can handle large amounts of data and expensive computations With multiprocessing, large amounts of data can be processed on different CPUs, speeding up code execution for expensive computations.', 'Threading is limited by the global interpreter lock (GIL) Threading is limited by the GIL, allowing only one thread at a time and having no actual parallel computation, making it ineffective for CPU-bound tasks.']}, {'end': 14760.743, 'start': 14290.997, 'title': "Python's global interpreter lock (gil) and multi-threading", 'summary': "Explains the necessity of python's global interpreter lock (gil) due to c python's memory management issues, and provides insights on using multi-processing and multi-threading for parallel computing in python.", 'duration': 469.746, 'highlights': ["The necessity of Python's Global Interpreter Lock (GIL) The GIL is needed in C Python due to its memory management technique called reference counting, which requires protection from race conditions to avoid leaked or incorrectly released memory.", 'Alternative methods to avoid the GIL for parallel computing The chapter outlines alternative approaches such as using multiprocessing, different free-threaded Python implementations like chython or iron Python, or utilizing Python as a wrapper for third-party libraries, as demonstrated in NumPy or scipy modules.', "Demonstration of using multi-processing for parallel computing The transcript provides a detailed example of utilizing multi-processing in Python by creating and running multiple processes, highlighting the use of the 'multiprocessing' module and the 'process' class to achieve parallelism."]}, {'end': 14978.802, 'start': 14761.103, 'title': 'Python threading module', 'summary': 'Explains how to use the threading module in python to create and start multiple threads, with an example of creating 10 child threads and sharing data between them, and also discusses the use of locks to prevent race conditions and demon processes.', 'duration': 217.699, 'highlights': ['Creating and starting multiple threads The speaker demonstrates the process of creating and starting 10 child threads using the threading module, with the main thread and 10 child threads, providing a practical example of multi-threading in Python.', 'Sharing data between threads The chapter explains how threads in Python can easily share data since they exist in the same memory space, simplifying the process of data sharing among threads.', 'Use of locks to prevent race conditions The discussion includes the use of locks to prevent race conditions, ensuring the proper synchronization of shared resources and preventing conflicts among threads.', 'Introduction to demon processes and queue for thread safe data exchanges The chapter introduces the concept of demon processes and how a queue can be used for thread-safe data exchanges, providing insights into advanced features of the threading module.']}, {'end': 15528.832, 'start': 14979.342, 'title': 'Python multithreading & locking', 'summary': 'Discusses python multithreading, demonstrating a race condition where threads try to modify the same variable simultaneously, and explains the use of locks to prevent race conditions, resulting in an end value of two.', 'duration': 549.49, 'highlights': ['The end value is one instead of two due to a race condition where two threads try to modify the same variable at the same time.', 'The use of a lock object from the threading module to prevent race conditions, ensuring that the end value becomes two.', "Demonstration of using the lock object as a context manager with 'with lock:' to manage the critical code section and ensure proper release of the lock."]}], 'duration': 1566.579, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo13962253.jpg', 'highlights': ['Processes are advantageous for CPU-bound tasks and multi-threading is beneficial for IO-bound tasks Processes take advantage of multiple CPUs and cores and are great for CPU-bound processing, while threading is great for IO-bound tasks such as talking to slow devices like a hard drive or a network connection.', 'Multiprocessing can handle large amounts of data and expensive computations With multiprocessing, large amounts of data can be processed on different CPUs, speeding up code execution for expensive computations.', "The necessity of Python's Global Interpreter Lock (GIL) The GIL is needed in C Python due to its memory management technique called reference counting, which requires protection from race conditions to avoid leaked or incorrectly released memory.", "Demonstration of using multi-processing for parallel computing The transcript provides a detailed example of utilizing multi-processing in Python by creating and running multiple processes, highlighting the use of the 'multiprocessing' module and the 'process' class to achieve parallelism.", 'Creating and starting multiple threads The speaker demonstrates the process of creating and starting 10 child threads using the threading module, with the main thread and 10 child threads, providing a practical example of multi-threading in Python.', 'The end value is one instead of two due to a race condition where two threads try to modify the same variable at the same time.', 'The use of a lock object from the threading module to prevent race conditions, ensuring that the end value becomes two.', "Demonstration of using the lock object as a context manager with 'with lock:' to manage the critical code section and ensure proper release of the lock."]}, {'end': 17475.666, 'segs': [{'end': 17432.573, 'src': 'embed', 'start': 17380.991, 'weight': 0, 'content': [{'end': 17387.857, 'text': 'So it will will return number times number times number.', 'start': 17380.991, 'duration': 6.866}, {'end': 17394.984, 'text': 'And now here, we can simply say, we create some numbers.', 'start': 17389.44, 'duration': 5.544}, {'end': 17406.532, 'text': 'So numbers equals a range object from zero to 10, or 10, or only to nine.', 'start': 17395.244, 'duration': 11.288}, {'end': 17411.915, 'text': 'And then we say, pool dot map.', 'start': 17407.252, 'duration': 4.663}, {'end': 17418.027, 'text': 'And now we map and we have to give it a function.', 'start': 17412.996, 'duration': 5.031}, {'end': 17422.049, 'text': 'So we give it the cube and the numbers.', 'start': 17418.067, 'duration': 3.982}, {'end': 17430.132, 'text': 'And this will return a result that we can then print.', 'start': 17423.949, 'duration': 6.183}, {'end': 17432.573, 'text': 'So print our result.', 'start': 17430.192, 'duration': 2.381}], 'summary': 'Using pool.map to compute cubes of numbers from 0 to 9.', 'duration': 51.582, 'max_score': 17380.991, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo17380991.jpg'}], 'start': 15529.072, 'title': 'Python threading and multiprocessing', 'summary': 'Covers python threading, queues, and locks for thread and process safe data exchanges, demonstrating the creation of 10 threads in a thread-safe environment, and the use of multiprocessing module for managing multiple processes and preventing race conditions through locks.', 'chapters': [{'end': 15771.394, 'start': 15529.072, 'title': 'Python queues and thread safety', 'summary': 'Discusses the concept of locks in python, followed by an explanation of queues in python, focusing on their usage for thread safe and process safe data exchanges in multi-threaded or multi-processing environments, along with important methods like q.get, q.empty, q.task_done, and q.join.', 'duration': 242.322, 'highlights': ['The concept of locks in Python is explained, and it is demonstrated how context managers acquire and release the lock, ensuring thread safety and process safety.', 'Queues in Python are introduced as excellent tools for thread safe and process safe data exchanges in multi-threaded or multi-processing environments, with the example of a queue of customers following the FIFO principle.', 'The process of creating and manipulating a queue in Python is explained, including methods like q.put, q.get, q.empty, q.task_done, and q.join, with a demonstration of how to check if a queue is empty, process objects, and block until all items in the queue have been processed.', 'Explanation of important methods for queue handling in Python is provided, including q.empty, q.task_done, and q.join, with their respective functionalities and significance in multi-threaded environments.']}, {'end': 16250.241, 'start': 15771.474, 'title': 'Threading in python: queue, worker, and demon threads', 'summary': 'Explains the implementation of threading in python using queues, workers, and demon threads, demonstrating the creation of 10 threads processing items in a thread-safe environment, and the purpose of demon threads as background threads that terminate when the main thread dies.', 'duration': 478.767, 'highlights': ['The chapter demonstrates the creation of 10 threads, processing items from a queue in a thread-safe environment, ensuring that no other thread can write at the same time into the queue position.', 'The explanation of demon threads highlights their purpose as background threads that will terminate when the main thread dies, ensuring the correct termination of the program despite the presence of an infinite loop.', 'The utilization of a lock to prevent confused print statements when multiple threads attempt to print at the same time ensures the correct execution of the program by synchronizing the access to the shared resource.']}, {'end': 16793.204, 'start': 16250.241, 'title': 'Multiprocessing module in python', 'summary': 'Delves into the details of the multiprocessing module, covering the creation and management of multiple processes, sharing data between processes using shared memory objects, and preventing race conditions through the use of locks, with an example demonstrating the impact of race conditions and the effectiveness of using locks.', 'duration': 542.963, 'highlights': ['The chapter covers the creation and management of multiple processes, sharing data between processes using shared memory objects, and preventing race conditions through the use of locks.', 'The use of shared memory objects, such as values and arrays, is explained for sharing data between processes in the multiprocessing module.', 'An example illustrating the impact of race conditions is provided, demonstrating how two processes trying to access and modify the same shared variable simultaneously can lead to lost operations, with a specific example showing the effect of race conditions on modifying a shared number.', 'The use of locks to prevent multiple processes from modifying shared data simultaneously is detailed, with a demonstration of using locks to ensure data integrity and prevent race conditions, ensuring that multiple processes can modify shared data without conflicts.', 'The use of locks as a context manager is explained as a better way to manage locks, ensuring that the lock is acquired and released automatically, simplifying the process of preventing race conditions and managing shared data.']}, {'end': 17475.666, 'start': 16793.877, 'title': 'Using shared values and data structures in python', 'summary': 'Covers the use of shared values, shared arrays, queues, and process pools in python multiprocessing, demonstrating how to exchange data between processes and manage multiple processes efficiently.', 'duration': 681.789, 'highlights': ['Shared values and arrays can be used to exchange and modify data between processes, preventing race conditions and ensuring process-safe data exchanges. Demonstrates using shared arrays and values to exchange and modify data between processes, avoiding race conditions and ensuring process-safe data exchanges.', 'Queues are utilized for process-safe data exchanges, following the first in first out principle and allowing multiple processes to exchange data. Explains the use of queues for process-safe data exchanges, following the first in first out principle and enabling multiple processes to exchange data.', 'Process pools manage multiple processes and enable parallel processing of data, simplifying the allocation of available processes and the execution of functions. Describes how process pools manage and allocate multiple processes, facilitating parallel processing of data and simplifying the execution of functions.']}], 'duration': 1946.594, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo15529072.jpg', 'highlights': ['Demonstrates using shared arrays and values to exchange and modify data between processes, avoiding race conditions and ensuring process-safe data exchanges.', 'The use of locks to prevent multiple processes from modifying shared data simultaneously is detailed, with a demonstration of using locks to ensure data integrity and prevent race conditions, ensuring that multiple processes can modify shared data without conflicts.', 'The chapter demonstrates the creation of 10 threads, processing items from a queue in a thread-safe environment, ensuring that no other thread can write at the same time into the queue position.', 'The concept of locks in Python is explained, and it is demonstrated how context managers acquire and release the lock, ensuring thread safety and process safety.', 'The chapter covers the creation and management of multiple processes, sharing data between processes using shared memory objects, and preventing race conditions through the use of locks.']}, {'end': 18387.272, 'segs': [{'end': 17857.999, 'src': 'embed', 'start': 17826.655, 'weight': 0, 'content': [{'end': 17836.802, 'text': "And yes, sometimes it's better to use keyword arguments, because it makes it more clear what they present,", 'start': 17826.655, 'duration': 10.147}, {'end': 17840.784, 'text': 'or we can rearrange the arguments in a way that makes the most readable.', 'start': 17836.802, 'duration': 3.982}, {'end': 17849.49, 'text': 'So, yeah, then we have the possibility to add default arguments.', 'start': 17843.086, 'duration': 6.404}, {'end': 17855.797, 'text': 'So I can say D and give them give this parameter a default value.', 'start': 17849.57, 'duration': 6.227}, {'end': 17857.999, 'text': "So let's say D equals four.", 'start': 17855.917, 'duration': 2.082}], 'summary': 'Using keyword arguments for clarity, rearranging arguments for readability, and adding default argument d=4.', 'duration': 31.344, 'max_score': 17826.655, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo17826655.jpg'}, {'end': 17973.654, 'src': 'embed', 'start': 17938.992, 'weight': 3, 'content': [{'end': 17941.592, 'text': 'so this is a function.', 'start': 17938.992, 'duration': 2.6}, {'end': 17954.135, 'text': 'if you mark a parameter with one asterisk or one star, then you can pass any number of positional arguments to your function.', 'start': 17944.811, 'duration': 9.324}, {'end': 17963.44, 'text': 'And if you mark your parameter with two stars, then you can pass any number of keyword arguments to this function.', 'start': 17955.096, 'duration': 8.344}, {'end': 17969.532, 'text': 'And typically, they are called arcs and quarks, but you can call them whatever you like.', 'start': 17964.409, 'duration': 5.123}, {'end': 17973.654, 'text': 'So also, for example, C.', 'start': 17969.612, 'duration': 4.042}], 'summary': 'Function parameters: 1 star for positional, 2 stars for keyword arguments.', 'duration': 34.662, 'max_score': 17938.992, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo17938992.jpg'}], 'start': 17476.346, 'title': 'Python function arguments', 'summary': 'Covers the usage of default arguments, variable length arguments, forced keyword arguments, and unpacking arguments in python functions, showcasing their implementation and rules, providing examples of their usage, and demonstrating their impact on parallel processing for faster calculations.', 'chapters': [{'end': 17597.545, 'start': 17476.346, 'title': 'Using python pool for parallel processing', 'summary': 'Explains how to use python pool to execute functions in parallel, demonstrating the allocation of pools, data splitting, and method execution, resulting in faster processing of calculations and returning results.', 'duration': 121.199, 'highlights': ['The pool in Python can be used to execute functions in parallel by different processes, resulting in faster processing of data and method execution.', 'The pool allocates the pools, splits the data, and runs the method in parallel, enhancing the efficiency of processing calculations.', 'To ensure proper execution, it is essential to call pool dot close before waiting for the pool to process all the calculations and return the results.', 'Using pool dot apply allows for the execution of a function with one argument in parallel, providing an effective method for processing functions.', 'One can easily use the pool to run different processes with a function, demonstrating the flexibility and efficiency of parallel processing.']}, {'end': 17826.175, 'start': 17598.606, 'title': 'Function arguments and parameters', 'summary': 'Covers the difference between function arguments and parameters, positional and keyword arguments, default arguments, variable length arguments, and the distinction between global and local arguments inside functions.', 'duration': 227.569, 'highlights': ['The chapter explains the difference between function arguments and parameters, clarifying that parameters are defined inside parentheses while defining a function, whereas arguments are the values passed for these parameters while calling a function.', 'It discusses the usage of positional and keyword arguments, highlighting that arguments can be passed in both forms, and notes that when using keyword arguments, the order is not important.', 'The chapter emphasizes the limitations when using a mix of positional and keyword arguments, stating that it is not possible to use another positional argument after a keyword argument, or assign a variable as both positional and keyword arguments.']}, {'end': 18387.272, 'start': 17826.655, 'title': 'Python function arguments', 'summary': 'Covers the usage of default arguments, variable length arguments, forced keyword arguments, and unpacking arguments in python functions, showcasing their implementation and rules while providing examples of their usage.', 'duration': 560.617, 'highlights': ['Default arguments can be set in Python functions, allowing for the definition of parameters with preset values, and can be overridden when needed, ensuring flexibility in function calls. Default value set to D=4, demonstrated with a function call using 3 arguments and printing D with default and overridden values.', 'Python supports variable length arguments using the *args and **kwargs syntax, enabling the passing of any number of positional and keyword arguments respectively, providing flexibility and versatility in function definitions. Illustration of using variable length arguments to accept any number of positional and keyword arguments in a function call, demonstrating their usage with examples.', 'Forced keyword arguments can be enforced by using the * symbol in function parameters, ensuring that all subsequent arguments are passed as keyword arguments, thereby providing control and clarity in function usage. Demonstration of enforcing keyword-only arguments by using the * symbol in function parameters, showcasing the requirement of keyword arguments and its impact on function calls.', 'Python allows unpacking of arguments from lists and dictionaries into function parameters, providing a convenient way to pass multiple arguments by unpacking the container, with the caveat that the length of the container must match the number of parameters. Explanation of unpacking arguments from lists and dictionaries into function parameters, emphasizing the requirement for the length of the container to match the number of function parameters.']}], 'duration': 910.926, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo17476346.jpg', 'highlights': ['The pool in Python can be used to execute functions in parallel by different processes, resulting in faster processing of data and method execution.', 'Default arguments can be set in Python functions, allowing for the definition of parameters with preset values, and can be overridden when needed, ensuring flexibility in function calls.', 'Python supports variable length arguments using the *args and **kwargs syntax, enabling the passing of any number of positional and keyword arguments respectively, providing flexibility and versatility in function definitions.', 'Forced keyword arguments can be enforced by using the * symbol in function parameters, ensuring that all subsequent arguments are passed as keyword arguments, thereby providing control and clarity in function usage.', 'The chapter explains the difference between function arguments and parameters, clarifying that parameters are defined inside parentheses while defining a function, whereas arguments are the values passed for these parameters while calling a function.']}, {'end': 21345.611, 'segs': [{'end': 18793.687, 'src': 'heatmap', 'start': 18576.306, 'weight': 1, 'content': [{'end': 18590.06, 'text': "Now, what will happen if we don't write this global here and we don't have this and simply assign number to three, then now,", 'start': 18576.306, 'duration': 13.754}, {'end': 18591.602, 'text': 'what will happen if we run this?', 'start': 18590.06, 'duration': 1.542}, {'end': 18597.373, 'text': 'this x is not available anymore.', 'start': 18594.452, 'duration': 2.921}, {'end': 18598.813, 'text': "So let's run this.", 'start': 18597.853, 'duration': 0.96}, {'end': 18609.377, 'text': 'So this will print zero, it prints the number that the still zero even after the function call where we set number equals three.', 'start': 18599.293, 'duration': 10.084}, {'end': 18617.185, 'text': 'And this is because here, we create a new local variable.', 'start': 18610.402, 'duration': 6.783}, {'end': 18620.807, 'text': 'So this has nothing to do with this global variable.', 'start': 18617.805, 'duration': 3.002}, {'end': 18625.229, 'text': 'And this is the this only lives inside your function.', 'start': 18621.187, 'duration': 4.042}, {'end': 18628.71, 'text': 'And it will not modify your global variable.', 'start': 18626.289, 'duration': 2.421}, {'end': 18635.994, 'text': 'So if you want to modify the global one, then you have to write global number here.', 'start': 18628.77, 'duration': 7.224}, {'end': 18638.295, 'text': 'And now it will print three.', 'start': 18636.614, 'duration': 1.681}, {'end': 18646.364, 'text': 'Yeah, so this is the difference between local and global variables.', 'start': 18642.041, 'duration': 4.323}, {'end': 18650.406, 'text': "Now let's talk about parameter passing.", 'start': 18647.284, 'duration': 3.122}, {'end': 18661.112, 'text': "So maybe you've heard already of the term call by value or call by reference.", 'start': 18651.887, 'duration': 9.225}, {'end': 18665.415, 'text': "And in Python, it's a little bit different.", 'start': 18662.453, 'duration': 2.962}, {'end': 18672.439, 'text': 'So it uses a mechanism which is known as call by object or call by object reference.', 'start': 18665.475, 'duration': 6.964}, {'end': 18679.161, 'text': 'And there are two rules that must be considered.', 'start': 18673.679, 'duration': 5.482}, {'end': 18685.104, 'text': 'So parameters are passed, or the parameters parsed in.', 'start': 18679.281, 'duration': 5.823}, {'end': 18696.648, 'text': 'No, sorry, the parameter parsed in is actually a reference to an object, but the reference is passed by value.', 'start': 18685.124, 'duration': 11.524}, {'end': 18702.121, 'text': 'And there is a difference between mutable and immutable data types.', 'start': 18697.978, 'duration': 4.143}, {'end': 18705.683, 'text': 'So this might be a little bit confusing.', 'start': 18702.902, 'duration': 2.781}, {'end': 18714.269, 'text': 'But this basically means that mutable objects like lists or dictionaries can be changed within a method.', 'start': 18706.244, 'duration': 8.025}, {'end': 18723.756, 'text': 'But if you rebind the reference in the method, then the outer reference will still point to the original object and is not changed.', 'start': 18714.93, 'duration': 8.826}, {'end': 18730.468, 'text': 'And immutable objects like integers or strings cannot be changed within a method.', 'start': 18724.797, 'duration': 5.671}, {'end': 18737.333, 'text': 'But immutable objects contained within a mutable object can be reassigned within a method.', 'start': 18731.149, 'duration': 6.184}, {'end': 18742.076, 'text': "So let's look at some examples to make this clearer.", 'start': 18738.514, 'duration': 3.562}, {'end': 18745.418, 'text': "So let's say we have a function foo.", 'start': 18742.616, 'duration': 2.802}, {'end': 18751.062, 'text': 'And this takes an argument x, and then it reassigns this.', 'start': 18746.259, 'duration': 4.803}, {'end': 18753.584, 'text': 'So it says x equals five.', 'start': 18751.122, 'duration': 2.462}, {'end': 18759.367, 'text': "And now let's say we have a var equals 10.", 'start': 18754.705, 'duration': 4.662}, {'end': 18760.788, 'text': 'So this is an integer.', 'start': 18759.367, 'duration': 1.421}, {'end': 18764.509, 'text': 'And then we call foo with this var.', 'start': 18761.508, 'duration': 3.001}, {'end': 18769.052, 'text': 'And after this, we want to print our var.', 'start': 18765.63, 'duration': 3.422}, {'end': 18778.796, 'text': 'Now this will still print 10, even if we assign x to five here.', 'start': 18771.453, 'duration': 7.343}, {'end': 18793.687, 'text': 'So because what happens here that var is an integer, and this is an immune immutable type, so it cannot be changed.', 'start': 18779.916, 'duration': 13.771}], 'summary': 'Explains local and global variables, and call by object reference in python.', 'duration': 217.381, 'max_score': 18576.306, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo18576306.jpg'}, {'end': 18714.269, 'src': 'embed', 'start': 18685.124, 'weight': 4, 'content': [{'end': 18696.648, 'text': 'No, sorry, the parameter parsed in is actually a reference to an object, but the reference is passed by value.', 'start': 18685.124, 'duration': 11.524}, {'end': 18702.121, 'text': 'And there is a difference between mutable and immutable data types.', 'start': 18697.978, 'duration': 4.143}, {'end': 18705.683, 'text': 'So this might be a little bit confusing.', 'start': 18702.902, 'duration': 2.781}, {'end': 18714.269, 'text': 'But this basically means that mutable objects like lists or dictionaries can be changed within a method.', 'start': 18706.244, 'duration': 8.025}], 'summary': 'Parameter passed by value, difference between mutable and immutable data types, mutable objects can be changed in a method.', 'duration': 29.145, 'max_score': 18685.124, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo18685124.jpg'}, {'end': 20415.275, 'src': 'embed', 'start': 20386.347, 'weight': 1, 'content': [{'end': 20391.214, 'text': 'So this will again, only be a copy of the reference here.', 'start': 20386.347, 'duration': 4.867}, {'end': 20397.179, 'text': 'And in order to make this independent, we have to say copy dot deep copy.', 'start': 20392.075, 'duration': 5.104}, {'end': 20403.625, 'text': 'And now if we run this, we see that the original boss is still 55.', 'start': 20397.54, 'duration': 6.085}, {'end': 20406.948, 'text': 'So this is the difference between shallow and deep copying.', 'start': 20403.625, 'duration': 3.323}, {'end': 20415.275, 'text': 'So we will learn about the concept of context managers and what other use, for.', 'start': 20411.111, 'duration': 4.164}], 'summary': 'Difference between shallow and deep copying explained, original boss remains 55.', 'duration': 28.928, 'max_score': 20386.347, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo20386347.jpg'}, {'end': 21172.673, 'src': 'embed', 'start': 21132.808, 'weight': 2, 'content': [{'end': 21137.933, 'text': 'So and then we will create a function that is a generator.', 'start': 21132.808, 'duration': 5.125}, {'end': 21148.402, 'text': "So if you don't know or are not familiar with generators and decorators already, then please have a look at my other tutorials,", 'start': 21138.534, 'duration': 9.868}, {'end': 21150.344, 'text': 'because I already talked about them.', 'start': 21148.402, 'duration': 1.942}, {'end': 21159.835, 'text': "So now let's create a generator here and call this open managed file.", 'start': 21151.245, 'duration': 8.59}, {'end': 21164.02, 'text': 'And this also will get a file name.', 'start': 21160.936, 'duration': 3.084}, {'end': 21169.466, 'text': 'And then here, oh, sorry, I misspelled it.', 'start': 21164.901, 'duration': 4.565}, {'end': 21172.673, 'text': 'So managed file.', 'start': 21169.487, 'duration': 3.186}], 'summary': 'Creating a generator function called open_managed_file with a file name.', 'duration': 39.865, 'max_score': 21132.808, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo21132808.jpg'}, {'end': 21308.424, 'src': 'embed', 'start': 21266.364, 'weight': 3, 'content': [{'end': 21269.206, 'text': 'So this will also work.', 'start': 21266.364, 'duration': 2.842}, {'end': 21275.229, 'text': "And now let's go over this again, what will happen here.", 'start': 21270.626, 'duration': 4.603}, {'end': 21279.052, 'text': 'So in because this is a generator.', 'start': 21275.87, 'duration': 3.182}, {'end': 21289.927, 'text': 'So this will first make sure to allocate our resource And then it will try to yield our resource.', 'start': 21279.692, 'duration': 10.235}, {'end': 21301.658, 'text': 'So and by yielding it, it will temporarily suspend its own execution.', 'start': 21290.808, 'duration': 10.85}, {'end': 21305.461, 'text': 'So we can continue here and use this file.', 'start': 21302.218, 'duration': 3.243}, {'end': 21308.424, 'text': 'So then we can do some operations with this file.', 'start': 21305.601, 'duration': 2.823}], 'summary': 'Generator allocates and yields resources, suspending execution temporarily, enabling file operations.', 'duration': 42.06, 'max_score': 21266.364, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo21266364.jpg'}, {'end': 21345.611, 'src': 'embed', 'start': 21341.307, 'weight': 0, 'content': [{'end': 21344.61, 'text': 'And if you liked it, please leave a like and subscribe to the channel.', 'start': 21341.307, 'duration': 3.303}, {'end': 21345.611, 'text': 'See you.', 'start': 21345.291, 'duration': 0.32}], 'summary': 'Encourage viewers to like, subscribe, and return', 'duration': 4.304, 'max_score': 21341.307, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo21341307.jpg'}], 'start': 18387.693, 'title': 'Python programming concepts', 'summary': 'Covers various python programming concepts including unpacking in functions, local vs global variables, parameter passing rules, asterisk use cases, copying mutable elements, and context managers. it emphasizes key concepts such as global variable modification, parameter passing rules, asterisk use cases, copying mutable elements, and context manager implementation.', 'chapters': [{'end': 18646.364, 'start': 18387.693, 'title': 'Unpacking in functions, local vs global variables', 'summary': "Explains how to quickly unpack a dictionary or a list into function arguments and discusses the difference between local and global variables, emphasizing the need to use 'global' keyword to modify global variables within a function.", 'duration': 258.671, 'highlights': ['The chapter explains how to quickly unpack a dictionary or a list into function arguments. The speaker demonstrates how to unpack a dictionary or a list into function arguments, emphasizing the need for the length of the dictionary to match the number of parameters and the keys to match the parameter names.', "The chapter discusses the difference between local and global variables, emphasizing the need to use 'global' keyword to modify global variables within a function. The speaker contrasts local and global variables, highlighting that modifying a global variable within a function requires the use of the 'global' keyword, and demonstrates the impact of not using it by creating a new local variable instead of modifying the global one."]}, {'end': 19046.512, 'start': 18647.284, 'title': 'Python parameter passing rules', 'summary': 'Explains the parameter passing rules in python, highlighting the call by object reference mechanism, the difference between mutable and immutable data types, and the impact on global and local variables. it also demonstrates examples of reassigning references and modifying mutable objects within a function.', 'duration': 399.228, 'highlights': ['Python uses call by object or call by object reference mechanism for parameter passing, where parameters are passed as references to objects, but the reference is passed by value. Python uses call by object or call by object reference mechanism for parameter passing. Parameters are passed as references to objects, but the reference is passed by value.', 'Mutable objects like lists or dictionaries can be changed within a method, while immutable objects like integers or strings cannot be changed within a method. Mutable objects like lists or dictionaries can be changed within a method, while immutable objects like integers or strings cannot be changed within a method.', 'Rebinding the reference in a method for immutable objects will not change the outer reference, while immutable objects contained within a mutable object can be reassigned within a method. Rebinding the reference in a method for immutable objects will not change the outer reference, while immutable objects contained within a mutable object can be reassigned within a method.', 'Examples demonstrate the difference in behavior between mutable and immutable objects, showing how reassigning references and modifying mutable objects within a function impact global and local variables. Examples demonstrate the difference in behavior between mutable and immutable objects, showing how reassigning references and modifying mutable objects within a function impact global and local variables.']}, {'end': 19801.173, 'start': 19051.357, 'title': 'Python asterisk use cases', 'summary': 'Discusses the various use cases of the asterisk or star sign in python, including multiplication, power operations, creating lists or tuples with repeated elements, unpacking function arguments, argument unpacking, merging containers into a list, and merging two dictionaries.', 'duration': 749.816, 'highlights': ['The asterisk can be used for merging containers into a list or merging two dictionaries, showcasing the versatility and flexibility of the asterisk in Python.', 'Argument unpacking is demonstrated using examples with lists, tuples, and dictionaries, emphasizing the importance of matching the number of elements and parameter names.', 'The chapter explores the use of the asterisk for creating lists, tuples, or strings with repeated elements, providing practical examples of how to utilize the asterisk for this purpose.', 'The tutorial covers the use of the asterisk for power operations and multiplication, highlighting its fundamental mathematical functionalities in Python.', 'The asterisk is employed for unpacking containers, such as lists, tuples, or sets, into single and multiple remaining elements, showcasing its utility for handling container unpacking scenarios.']}, {'end': 20415.275, 'start': 19801.873, 'title': 'Copying mutable elements', 'summary': 'Covers the concept of copying mutable elements, demonstrating the use of the assignment operator, the built-in copy module, shallow and deep copying, and applying these techniques to both built-in types and custom objects.', 'duration': 613.402, 'highlights': ['The assignment operator creates a new variable with the same reference for immutable types, while for mutable types like lists, it only copies the references, leading to changes in the original when modifying the copy.', 'Shallow copying is one level deep, only creating copies at the first level and copying references of nested child objects, demonstrated using various methods like list slicing and the built-in copy module.', 'Deep copying creates a full independent copy, preserving the original from getting affected, as shown with examples using the built-in copy module for custom objects and nested structures.']}, {'end': 21345.611, 'start': 20415.831, 'title': 'Context managers in python', 'summary': "Discusses the concept of context managers, showcasing examples such as using 'with open' statement for file handling and creating a custom context manager class with enter and exit methods, and also demonstrates implementing a context manager as a function using a generator and context manager decorator.", 'duration': 929.78, 'highlights': ["The 'with open' statement is a typical example of using context managers in Python, providing a cleaner and more concise way to open and handle file resources. The 'with open' statement is a recommended method to open a file, ensuring precise allocation and release of resources, and offering a cleaner and more concise approach compared to traditional file handling methods.", 'Demonstrates the implementation of a custom context manager class with enter and exit methods, showcasing the allocation and release of resources and handling exceptions within the context manager. The demonstration of creating a custom context manager class involves the implementation of enter and exit methods to allocate and release resources, as well as handling exceptions within the context manager, providing a comprehensive understanding of its functionality.', 'Illustrates the usage of a function as a context manager by creating a generator and utilizing the context manager decorator, offering an alternative method for resource management. The illustration of using a function as a context manager involves creating a generator and utilizing the context manager decorator, presenting an alternative approach for resource management using context managers in Python.']}], 'duration': 2957.918, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGOBQPFzWKo/pics/HGOBQPFzWKo18387693.jpg', 'highlights': ['The asterisk can be used for merging containers into a list or merging two dictionaries, showcasing the versatility and flexibility of the asterisk in Python.', "The 'with open' statement is a typical example of using context managers in Python, providing a cleaner and more concise way to open and handle file resources.", 'The chapter explains how to quickly unpack a dictionary or a list into function arguments, emphasizing the need for the length of the dictionary to match the number of parameters and the keys to match the parameter names.', 'Python uses call by object or call by object reference mechanism for parameter passing, where parameters are passed as references to objects, but the reference is passed by value.', 'The assignment operator creates a new variable with the same reference for immutable types, while for mutable types like lists, it only copies the references, leading to changes in the original when modifying the copy.']}], 'highlights': ['The course is aimed at an intermediate skill level, providing advanced topics to enhance Python skills.', 'Patrick, the instructor, shares helpful tips along the way and goes into detail on various topics.', 'The tutorial is suitable for those who have completed a beginner course and are looking for the next step.', 'The chapter covers the essential concepts of Python lists, including creation, indexing, iteration, methods like append, insert, pop, remove, clear, reverse, sort, slicing, and copying.', 'A list is a collection data type that is ordered, mutable, and it allows duplicate elements.', 'The course is split into 21 sections, and in my opinion, every experienced Python programmer should know about these topics.', 'Dictionaries are more efficient than lists and tuples for certain operations, as seen by the time taken for creation.', 'The chapter discusses set operations in Python, including iteration, checking for elements, union, intersection, difference, symmetric difference, and methods to modify the original sets.', 'Strings can be created using either single or double quotes, with single quotes being more common, and triple quotes for multi-line strings and documentation.', 'The F strings method for string formatting in Python 3.6 or newer is highly recommended due to its readability, conciseness, and speed, especially with multiple variables, as it evaluates the expressions at runtime.', 'The default dict returns a default value when a key error occurs, providing efficient error handling compared to a normal dictionary.', 'The deck, a double ended queue, facilitates efficient addition and removal of elements from both ends, as well as rotation of elements within the queue.', 'The iter tools module provides advanced tools for handling iterators, including functions like product, permutations, and combinations.', 'The reduce function in Python is used to apply a specified function to the elements of a sequence to reduce it to a single value, for example, calculating the product of a sequence.', 'Custom exceptions can be defined by subclassing from the base exception class.', 'Different block levels in Python logging are debug, info, warning, error, and critical.', 'The chapter discusses the use of JSON format for logging in a microservice architecture, recommending the open source Python JSON logger available on GitHub.', 'The random module in Python is used to generate pseudo-random numbers for various distributions, including functions like random(), uniform(), randint(), normalvariate(), choice(), sample(), choices(), and shuffle() for different use cases and distributions.', 'Covers python decorators, including syntax, functionality, and application', 'Generators are functions that return an object that can be iterated over, generating items only one at a time and only when asked for.', 'Processes are advantageous for CPU-bound tasks and multi-threading is beneficial for IO-bound tasks Processes take advantage of multiple CPUs and cores and are great for CPU-bound processing, while threading is great for IO-bound tasks such as talking to slow devices like a hard drive or a network connection.', 'Demonstration of using shared arrays and values to exchange and modify data between processes, avoiding race conditions and ensuring process-safe data exchanges.', 'The pool in Python can be used to execute functions in parallel by different processes, resulting in faster processing of data and method execution.', 'The asterisk can be used for merging containers into a list or merging two dictionaries, showcasing the versatility and flexibility of the asterisk in Python.', "The 'with open' statement is a typical example of using context managers in Python, providing a cleaner and more concise way to open and handle file resources."]}