Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
pass: ignores the body after it. It useful if you want to specialise a class and make it do nothing more than the parent class. (Yes, you need to know a bit about inheritance) finally: when you absolutely want the action in the finally block to be executed IN ANY circumstances, even if there is a problem beforehand. The point is, I can't really illustrate that... lambda: when you want to make a function that has no name, it's useful when you use filter, map, or other things like that... For instance: L = [1, 2, 3, 4, 5, 6, 7, 8, 100, 9182, 9185] # filter only the even numbers L = filter(lambda x: x % 2 == 0, L) L <- [2,4,6,8,100,9182] yield: well, that makes a generator. These are very useful but it gets very technical very quickly. It even bends the mind of core developers sometimes, so... Try to understand them as best as you can, but good luck with that...
17th Feb 2017, 3:52 AM
Amaras A
Amaras A - avatar