Browsing Category
Python
212 posts
Python is a general-purpose, high-level programming language. It is known for its elegant syntax and its focus on code readability. Python is dynamically typed, which means that the type of a variable is not declared at compile time. This can make Python code more concise and easier to read.
Reversing a String in Python: Complete String Manipulation and Algorithm Implementation Guide
Reversing a string sounds like the simplest possible programming exercise, and in Python, it genuinely is a one-liner.…
str.translate: Translating Characters in a String in Python: Complete Character Mapping and Transformation Guide
For a long time, I handled character-level text cleanup with chains of .replace() calls — stripping punctuation, swapping…
Changing the Capitalization of a String in Python: Complete Case Conversion and String Formatting Guide
I’ve written enough text-processing code to know that “just change the case” is rarely as simple as it…
Basics of String Formatting in Python: Complete f-Strings, format(), and % Formatting Guide
I’ve written Python code across more than one era of its string formatting history, and honestly, having three…
Custom Functionality with Metaclasses in Python: Complete Advanced Object-Oriented Programming Guide
Metaclasses were one of those Python topics I avoided for years, mostly because every explanation I read made…
Introduction to Metaclasses in Python: Complete Advanced Class Creation and Customization Guide
There’s a well-known quote from Tim Peters that I didn’t fully appreciate until I actually learned metaclasses myself:…
Descriptors and Dotted Lookups in Python: Complete Attribute Access and Property Management Guide
When I first started writing Python, I treated obj.attribute like magic. You write a dot, you get a…
Default Values for Instance Variables in Python: Complete Class Initialization and Attribute Management Guide
I still remember the exact moment this bit me. I had a class with a tags argument that…
Multiple Inheritance in Python: Complete Method Resolution Order and Super() Implementation Guide
Multiple inheritance has a bad reputation, and for a while I avoided it entirely because every tutorial I…
Monkey Patching in Python: Complete Runtime Modification and Dynamic Programming Techniques Guide
The first time someone told me Python lets you modify a class or module after it’s already been…