Category python-top-tutorials

Python vs. C++

Python vs. C++ Both Python and C++ are among the most popular programming languages. They each have their strengths and weaknesses. In this chapter, we’ll examine their characteristics. Compiled vs. Interpreted C++, like C, is a compiler-based language. The compiler…

Python Enumerations

Python Enumerations The term “enumeration” refers to the process of assigning a set of strings to fixed constant values, so that each string can be identified by the value associated with it. Python’s standard library provides the enum module. The…

Python file handling

Python File Handling When we use any computer application, we need to provide some data. This data is stored in the computer’s main memory (RAM) until the application finishes running, at which point the memory is cleared. We want to…

Python loop dictionary

Python Dictionary Loop Unlike lists, tuples, or strings, the Python dictionary data type is not a sequence because items do not have positional indices. However, dictionaries can still be iterated over using various techniques. Example 1 Run a simple for…

Python Tools/Utilities

Python Tools/Utilities The standard library contains many modules that can be used both as modules and as command-line tools. dis Module The dis module is a disassembler for Python. It converts bytecode into a more human-readable format. Example import dis…

Python weak references

Python Weak References Python uses a reference counting mechanism to implement its garbage collection strategy. Each time an object in memory is referenced, a reference count is incremented. Conversely, when a reference is removed, the reference count is decremented. If…