#Python Python 101 : Manually setting up a context manager Context managers make it possible for us to manage our resources. When python enters a context , it calls the __enter__() methods and it calls the __exit March 30, 2023 Share
#Python Python 101 : List and tuple comprehension A list is an aggregate of elements enclosed in brackets. A list comprehension is constituted of: an expression. a for loop. an if clause within the loop March 27, 2023 Share
#Python Python 101 : Merging dictionaries Below is one of the ways that we could use to combine two dictionaries into one: We could even use more than two dictionaries as we can see in the belo March 24, 2023 Share
#Python Python 101 : Generators Iterators loop over existing elements in a list for example. Generators generate elements as we ask for them, which helps us not overload the memory in March 23, 2023 Share
#Python Python 101 : From dictionaries to lists Below are a couple of examples of how to turn a dictionary into a list . Our first example used the items() method for form a list as we see below: Our s March 20, 2023 Share
#Python Python 101 : Local and Global variable - locals(), globals() - Sometimes, we lose track of our variables inside big chunks of code. Python gives us the possibility to display variables depending on their namespace March 15, 2023 Share
#Python Python 101 : Dictionaries - keys with multiple values - A dictionary usually maps a key to one value . Sometimes, we need a key to be linked to multiple values . We could do that using lists as you can see be March 13, 2023 Share
#Python Python 101 : Ways of printing a dictionary values. For example, we have the below dictionary " d ". We could print the values of our dictionary , using the below code: Or by using this variation: March 10, 2023 Share
#Python Python 101 : The "Enum" object Enum is python object that represents a group of variables that are assigned a constant value. Below is a simple example - we need to include the " March 08, 2023 Share
#Python Python 101 : Breaking out of a "while" loop - while ... else - We could use the " while ... else " construct to break out of a " while " loop as soon as a condition is fulfilled. In the below exampl March 05, 2023 Share
#Python Python 101 : Mutables a default parameters to functions. When we pass a mutable default argument to a function - here the __init__() funtion - , that accepts a list, changing the default mutable argument will a March 01, 2023 Share
#C programming C Programming101 : " #ifdef, #endif " statements - conditional compilation - The #ifdef - #endif statement dictates what parts of a program are taken into account during compilation, depending on whether a variable is defined or February 21, 2023 Share
#Python Python 101 : __slots__ and data management. For classes with small, simple data, we could save memory by using the __slots__ attribute to the class. For example the Car class below: With __slots_ February 13, 2023 Share
#Python Python 101 : Decorators with parameters - passing arguments to a decorator - We could use decorators with parameters for example to control the flow of the execution of a decorator as we can see below: As we can see above, we co February 06, 2023 Share
#Python Python 101 : Changing the behavior of the "range()" function We create an custom iterator function that we will use with a " for " loop: We use it as below: The " yield " function acts as a return January 30, 2023 Share
#Python Python 101 : Reading text from a file The below example reads input from the " /home/albert/file " file and prints it: We use " StopIteration " exception to exit a loop so i January 24, 2023 Share
Python 101 : Iterables and variable-length tuples in a list Iterables are objects that we can loop through, like - lists, tuples, sets, dictionaries, strings, ... -. We have the below list with different member January 19, 2023 Share
Python 101 : Iterating through lists an dictionaries We have the below list composed of pairs, we list it using the below: We could also list the pairs as below: We could also list all the elements of the l January 16, 2023 Share
#Istio, #Kubernetes Istio 101 : "Envoy" sidecar injection into a kubernetes deployment Injection of sidecar in a kubernetes application, means that istio is going to modify the deployment's Yaml file of our pods to include a side car January 10, 2023 Share
#Bash Bash 101 : Script default arguments When using a bash script, we could have "replacement" default arguments if none are given. Our example replaces the " $1 " with repla January 04, 2023 Share
#Istio Istio 101 : Loadbalancing, attempts and retries - DestinationRule, VirtualService - Istio provides loadbalancing for kubernetes . It also supports retries for failing pods and circuit breaking to reject requests for pods with a " de January 02, 2023 Share