0%

🪄 Shape The Unseen

An empty class, just a name and form. pass keeps it valid while holding nothing. Later, breathe life into it. A silent vessel, waiting for spells to fill it.
🔮 class Coffee: pass

Before a vessel can hold meaning, it must first exist. Before an object can possess attributes, its blueprint must be drawn. The class keyword creates that blueprint. The pass statement is not emptiness. It is a placeholder. A promise that says “this container is intentionally empty for now.” Python needs at least one line inside a class. pass fulfills that need without doing anything.

🕯️ Magic Note

A class with pass is perfectly valid Python. You can instantiate it, assign attributes to its instances, and even add methods later through inheritance or monkey patching. The empty class is a blank canvas, not a broken one.

The syntax class Coffee: pass defines a class named Coffee. The pass statement tells Python to do nothing and move on. Then brew = Coffee() creates an instance (an object) from that class. The object exists even though the class has no predefined structure.
  • pass works anywhere Python expects an indented block
  • Empty classes are useful as simple data containers or type markers
  • You can add attributes dynamically: brew.temperature = 75
  • Can later add methods by defining them in the class or subclassing
💡 Use pass as a placeholder when sketching code structure. It lets you define classes and functions before implementing them. For true lightweight data containers without custom behavior, consider dataclass or NamedTuple instead of empty classes with dynamic attributes.
PatternSyntaxUse Case
Empty classclass Name: passPlaceholder or simple container
Class with docstringclass Name: “””doc”””Documented empty class
Class with pass laterclass Name:\n passFuture implementation planned
Instantiationobj = Name()Creating an object instance
⚠️ Classes defined with only pass are not particularly useful on their own. They have no init method, so all instances are identical by default. You must manually add attributes to each instance. For most real world use cases, a proper init method is better.
Examples

Python

# Creating an empty class and using it as a container

class Coffee:

pass

brew = Coffee()

brew.name = “Espresso”

brew.strength = 9

brew.temperature = 92

print(brew.name)

# Output: Espresso

Python

# Using empty class as a namespace or configuration holder

class Config:

pass

Config.THEME = “dark”

Config.FONT_SIZE = 16

Config.ANIMATIONS = True

print(Config.THEME)

# Output: dark

Python

# Empty class as a base for future expansion

class Spell:

pass

class FireSpell(Spell):

def cast(self):

return “🔥”

class IceSpell(Spell):

def cast(self):

return “❄️”

fire = FireSpell()

print(fire.cast())

# Output: 🔥

Common Mistakes
  • Forgetting pass after an empty class declaration, causing an IndentationError
  • Expecting empty classes to have predefined attributes, all attributes must be added manually
  • Using pass when you actually need an init method with default values

⚡ Whisper

Every spell begins as an empty shape. The vessel exists before the liquid pours. Let your class breathe in silence at first. Life comes later. Form is the first magic.