Introduction If you search for the phrase “Process vs Thread” I bet you, most of the articles you may find follow a typical structure. You will probably find a list of points in a tabular or bullet format contrasting process vs thread. Some articles are excellent but many lack a proper context. In this post,
Introduction Python programming language is a dynamically typed language. In other words, variable types are not explicitly declared as in statically typed languages (ex. C++). Instead, type checking is performed at runtime as opposed to compile time. The debate of which is better? a dynamically typed or statically typed language is not discussed in this
Introduction Welcome to a new code snippet in Python. Today, we are going to clarify the difference between items() and iteritems() methods when using a Python dictionary. Let us first quickly refresh our memory about lists, tuples and dictionaries in Python: A list is an array data structure that can be edited A tuple is
Introduction In this post, I am going to show how to setup gitlab CI so that a build is triggered whenever a new feature or bug fix branch is opened for review (i.e. merge request, note: if you use Github, it is called a pull request). The build should also be triggered whenever new (ex.
Introduction In today’s Python code snippet, we are going to talk about deleting, removing and popping list elements: remove method: takes a value as input, searches for it, removes the first match. If the item is not found it errors out del function: removes an item at a specific index, can delete all elements or
Welcome to a new Python code snippet. In this post, we are going to suggest a couple of methods to flatten a list of lists. The final output is going to be a one dimensional list. Let us take an example: Using nested loops Using list comprehensions Using sum function Using list extend Using chain
Question Python list data structure has append() and extend() methods. Both methods add new items to the list. What is the difference between the two? Append vs extend list in Python Append: adds a new item to the end of the list. The item can be an object of any type. It could be a
Introduction Welcome to a new operating systems post. Today, we are going to clarify some terms frequently used in concurrency and operating systems design. You have probably heard of the following terms… Processes and threads Shared memory and resources Race conditions Mutual exclusion Critical section or critical region Synchronization primitives or constructs Locks and spin
Introduction In this post, we are going to discuss a rarely used Python feature. We are familiar with the regular for and while loops but using an else clause after a loop is not common. We can live without this language feature however it can be used to write elegant code. Let us take an
Welcome to a new Python code snippet. In this post, we are going to learn how to check whether a file or directory (ex. file path) exists using Python. A common use case is to check if a file exists before opening for reading or writing. Let us take some examples… Check file exists in