Python repr vs str
Understand repr vs str in Python and learn how to use them in any custom class. Examples of using repr for debugging.
Code
Inside articles there are more settings: width, font size, series position and code.
Saved in this browser.
Understand repr vs str in Python and learn how to use them in any custom class. Examples of using repr for debugging.
What makes a Python object hashable, why lists aren't, how hash(), __hash__ and __eq__ work together, and how to make your own class hashable.
Learn whether a variable can change (mutable) or not (immutable). Mutable: List, Dict, Set. Immutable: String, Int, Float, Bool, Tuple, Range, Decimal.
Learn how to build your own Collection in Python step by step: Container, Sized and Iterable explained, plus the difference between an Iterator and an Iterable.
Learn how to build a data stream by balancing memory use and processing time: buffer data for a steady flow, generate data on demand, and cache results.
Something we all overlook when starting with Python, and one of the most puzzling: functions (or methods) that take *args and **kwargs as parameters.
Learn how numeral system combination tables work and convert between binary, decimal, hexadecimal and octal with simple mental math.
Learn what the binary number system is, how it relates to decimal, octal, hexadecimal and base 64, and how to read bases and number notations.
In this post we will show examples of how to use virtual environments (venv) in python to isolate our projects between each other
Learn how to build JDK 9 from source code, just ahead of its imminent release. A step-by-step guide to get the new Java version running on your machine.
In this article we describe the Singleton pattern in Python, a pattern that makes sure a class has only one instance. Learn two ways to implement it.
Java's diamond operator lets you cut down on verbosity when writing your code. Learn how it works with generics and type inference, and where it falls short.