args vs kwargs, async in PY šŸ, dependency management šŸ“¦

By Prajwal Haniya

Techletter #101 | November 30, 2024

What is the difference between *args and **kwargs in python?

In Python, you can write functions that accept any number of arguments or keyword arguments by using a special syntax.

To get infinite arguments, use *args and for infinite keyword arguments, use **kwargs.

The ā€œargsā€ and ā€œkwargsā€ words are not important. Thatā€™s just convention. You could have called them *bill and **ted and it would work the same way. The key here is in the number of asterisks.

Link: https://python101.pythonlibrary.org/chapter10_functions.html#args-and-kwargs

Asynchronous programming in python

The asynchronous programming is not as straight as in Node.js. If you are into python after writing a lot of code in node, you feel why this simple concept is not so simple in Python. It may be because the python was not designed to be asynchronous, the asynchronous way of writing code was introduced in the Python 3.4 and has evolved a lot after that.

Links:

https://sunscrapers.com/blog/python-async-programming-basics/

https://medium.com/velotio-perspectives/an-introduction-to-asynchronous-programming-in-python-af0189a88bbb

https://realpython.com/async-io-python/

Exceptions in Python

List of common exceptions are:

Exception, AttributeError, IOError, ImportError, IndexError, KeyError, KeyboardInterrupt, NameError, OSError, SyntaxError, TypeError, ValueError, ZeroDivisionError.

A complete explanation of this can be found here:

Link: https://python101.pythonlibrary.org/chapter7_exception_handling.html#common-exceptions

Python Dependency management

Managing dependencies become hard as project grows.

The key reason for adopting good dependency management practices isĀ reproducibility. Reproducibility means we can follow a set of steps and always get exactly the same result.

As soon as a single step in the chain of instructions is not reproducible, the behavior of code becomes non-deterministic.

Below is the link for in depth article about dependency management in Python

Link: https://nielscautaerts.xyz/python-dependency-management-is-a-dumpster-fire.html?utm_campaign=Data_Elixir&utm_source=Data_Elixir_512