Did you know that Python’s max function has many options and ways of use that few people know about? In this post we will see different ways of using the max function in Python.
We spend a considerable amount of time dealing with strings, so it is important to know how to present them the way we want. That is what we will see in this article, with plenty of examples.
Have you ever seen the term “yield from” in some Python code and wondered what it was? In this article we will dive even deeper into generators and understand, with examples, what “yield from” means and how we can use it to make our code even more efficient.
Did you know you can create an infinite sequence without running into memory problems and still consume that sequence however you like? Today we will look at a specific function from the itertools module, islice, which is excellent for our purpose. We will learn to use it with the example of the Fibonacci sequence.
In this article, we will see how the all and any functions, available in a standard installation of Python, work. We will also see what each of them is useful for and what to watch out for when using them, based on a complexity analysis.
Do you know the difference between a “normal” function and a generator function in Python? What is the difference between the return of a usual function and the yield of a generator? In this article we answer these questions and dig deeper into some aspects of the language. We will see how generators in Python can make your code up to 1000 times faster.
Do you know what an iterable is? And an iterator? How do you recognize these structures in Python? Answering these questions is the goal of this article.
The and and or operators are short-circuit operators, meaning that the second operand is only evaluated if the result cannot be determined from the value of the first operand alone. Confusing? Let’s look at some examples in this article.