#Python Python 101 : Turning a "String" into a "Tuple" using the constructor We can easily convert a Sting into a tuple by using the constructor function of the class tuple Tuples: A tuple is a data type in Python that is ordered March 17, 2024 Share
#Python Python 101 : How to change immutable strings Strings in python are immutable. Below is an example that illustrates that characteristic of strings: We get the error mentioned above : " TypeError March 17, 2024 Share
#Python Python 101 : Immutability of a Tuple. A tuple is a group of references to different items. These references or locations in memory are immutable, but the items these references point to co March 06, 2024 Share
#Python Python 101 : Unpacking Sets, Lists and Tuples using the "*" symbol The " * " can be used for un-packing lists , tuples , or sets as we see in the following examples. For tuples : For lists : And for sets : February 21, 2024 Share
#Python Python 101 : Sorting a List as Strings or as Integers We have for example the below list : When we try to sort it, we get the above error, since the list is a mix of integers and strings . We could remedy tha February 16, 2024 Share
#Python Python 101 : Exception handling. To handle errors we use the " try/except/else/finally " clauses. Below is a simple illustrating their use: The code will continue running inste February 13, 2024 Share
#Python Python 101 : Decorators workflow - A simple example - Below is an example of a decorator function that uses the arguments of the original function - non-decorated function -. Remark: The numbers describes t January 03, 2024 Share
#Python Python 101 : Nested function and "non-local" variables Sometimes we don't want the local variables in nested functions to be interpreted as local variable by python . Below is a simple example using the November 20, 2023 Share
#Python Python 101 : Introduction to decorators Decorators are a way to add functionalities to a function without altering the original one. In the below example, we make the original() function prin November 03, 2023 Share
#Python Python 101 : Data classes - Class decorators - Dataclass is a class decorator that makes it easy for us to create classes that are "data" oriented. for example: Is equivalent to: The @datac October 10, 2023 Share
#Python Python 101 : Shallow copies - Lists and Tuples - We have the below data structures: We try to add an elements to one list as below: Appending " 10 " to list1 does not add " 10 " to list October 02, 2023 Share
#Python Python 101 : Deep copies and shallow copies - List example - In the below example, we make a shallow copy " l2 " of a list " l1 " using regular " = " assignment, we also make a deep copy September 15, 2023 Share
#Python Python 101 : Decorators with arguments - Passing a parameter 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 August 31, 2023 Share
#Python Python 101 : Overriding function - The super() method - When we override a function in a subclass. The super() function helps us call the "original" method in the parent class as we can see in the August 14, 2023 Share
#Python Python 101 : Keyword arguments To avoid confusing positional "regular" argument, we could name our parameters and specify them by name using keyword arguments . When calling August 04, 2023 Share
#Python Python 101 : Interfaces - blueprints of classes - An interface does nothing. It only provides a blueprint comprised of methods that classes - using that blueprint - must follow. To create an interface July 26, 2023 Share
#Python Python 101 : Private variables There are no real private variable in python , but we can keep some variable from being visible from outside the "private" scope. In our below July 18, 2023 Share
#Python Python 101 : An introduction to Iterators and Iterables. In python , iterables are objects that we can loop through. These objects implement an " __iter__() " function that returns an iterato r . The iter July 10, 2023 Share
#Python Python 101 : The keyword arguments and the "*" parameter A keyword argument has the following format " name=value ". We can pass a keyword argument to a function as follows: We could also call the fun July 03, 2023 Share
#Python Python 101 : Context managers - "with" expression - Context managers give you a way to allocate and release resources depending on your need s. To define context managers we make use of the the expressio June 26, 2023 Share