function
Python filter function
This is an interesting feature in python. Suppose you have a list of items and you want to apply quick filters such as “greater than x”, “less than x”, “above average”, “below average” on list items, then filter() method makes it quite handy. Typical syntax of filter function is like filter(some_func_name, list_of_items) You can also […]
Python reduce function
This is an interesting short cut function when you want to process list items recursively. This function takes two arguments in as input, one function name that you want to apply on list and second the list itself. In python3 reduce is available in func_tools module. Typical syntax to invoke this is reduce(function_name, list_of_items) and […]
Python map function
Think of a situation, where you want to perform same operation on a group of objects. For eg, you want to run same commands on a family of network devices. Traditionally, to achieve this you have to iterate device objects one by one and then apply required function to run commands on devices. In python, […]