- A programming language is said to be First class function if it treats functions as First class citizens
- assigned to a variable
- returned from a function
- include being passed as a argument
higher order functions : pass functions as arguments and return function as result of other function
- Allows to create own iterator functions
- And return a iterator object, not a single value
- yield statement is used rather than a return statement
- is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure
- Follows functions first class concept
-
Program terminates as soon as it encounters an error
-
An error can be a syntax error or an exception.
-
The try and except Block: Handling Exceptions The try and except block,is used to catch and handle exceptions
-
Raising an Exception use raise keyword to throw an exception if a condition occurs The statement can be complemented with a custom exception.
-
The AssertionError Exception (given logic is true or false) We assert that a certain condition is met. If this condition turns out to be True,The program can continue. If the condition turns out to be False, you can have the program throw an AssertionError exception