Function & Type Inference: My Guide to Efficiently Getting Started with Python (Part 2)

Nepal Brothers
1 min readSep 28, 2021

If you feel like you are somewhat uncomfortable reading through the 2nd part, you should definitely go to the 1st part and skim it or go through it.

Here, we are going to have a little more advance topics than we had in the first part. It will be based on nested functions, functional programming, typing and so on.

Type Inference

Programming languages like Java has strong typing, meaning that, you can’t run the code if you are going to calculate a sum of string (which sounds weird anyway). So, having type inference will make your code strong, contain less bug and more predictable.

Nested function

Passing a function as a parameter

You actually can pass a function in a function. For example, lets say you have a list of income by monthly basis. You would like to filter the list in odd or even months, and you would do it like this:

--

--