Browse by Topic

Popular

Latest

Latest Python Posts

Diagram showing an integer value being converted to an octal string with a 0o prefix by Python's oct() function
Python

Python oct() Function: Syntax and Behavior

Learn how Python's oct() converts integers to octal strings, which inputs it accepts, how the 0o prefix works, and when to use format() instead.

oct functionbuilt-in functionsinteger conversionnumber formatting
Illustration of the Python bin() function converting an integer into its binary string representation with the 0b prefix.
Python

Python bin() Function: Converting Integers to Binary

python bin function: Learn how Python's bin() function converts integers to binary strings, handles negative values, and compares with format() for practical bit-level...

bin()Python built-insbit manipulationbinary conversion
Python chr function converting an integer to a Unicode character, illustrated with a code point and resulting character.
Python

Python chr Function: Converting Integers to Characters

Learn how to use Python's chr() function to convert integers to Unicode characters, handle errors, and avoid common pitfalls.

PythonUnicodechrord
A visual representation of Python's ord() function turning the character 'A' into the integer 65.
Python

Python ord Function: Character to Integer

Use Python's built-in ord() function to convert single characters to Unicode code points, avoid common errors, and see practical examples.

Pythonord()Unicodechr()
Illustration of a Unicode character being converted to an ASCII escape sequence by the Python ascii() function.
Python

Python ascii() Function: Escaping Non-ASCII Characters

Learn how Python's ascii() function converts objects to ASCII-safe printable strings, escapes Unicode characters, and differs from repr().

ascii functionPython builtinsreprUnicode escaping
Illustration of Python repr function showing an object converted to a string representation.
Python

Python repr Function: How It Works and When to Use It

Python's repr() returns unambiguous string representations. See how to override __repr__ in your classes and when to use repr() instead of str().

pythonreprdebugging__repr__
Illustration of a Python dictionary with keys being hashed into buckets, representing the hash function concept.
Python

Python Hash Function: Usage and Customization

Understand Python's hash() function, its role in dicts and sets, and how to implement custom __hash__ and __eq__ correctly.

hash()dictionariescustom __hash__hash randomization
A visual metaphor showing Python objects in memory with unique identity markers, illustrating the id() function.
Python

Understanding Python's id() Function

python id function: Explore how Python's id() function returns object identity, how CPython assigns memory addresses, and when relying on id() is safe or misleading.

pythonobject identitymemory addressbuilt-in functions
Illustration of a Python object becoming callable through the __call__ method, shown as a function-style button with a state container.
Python

What Makes an Object Callable in Python

Learn what makes an object callable in Python, how callable() works, and when implementing __call__ creates a useful callable object.

pythoncallable()__call__functools.partial
Illustration of Python all() function checking a list of boolean values, with a checkmark for true and an X for false.
Python

Python all() Function: Syntax, Usage, and Edge Cases

Learn how Python's all() function works, its syntax, behavior on empty iterables, and practical usage with generator expressions.

PythonBuilt-in FunctionsIterablesBoolean Logic