If you’ve been using Python for a while, you’ve probably noticed the awkward "split personality" of the language. You had "types" (like int, list, and dict) and you had "classes" (the ones you defined yourself). They behaved differently. You couldn't inherit from list. type(instance) returned instance, while type(int) returned type. It was a wart on an otherwise beautiful language.
Python 2.2, released today, finally fixes this with "New-Style Classes." By making all classes inherit from a common object base, the distinction between built-in types and user classes has vanished. You can now do things that were previously impossible, like creating a custom class that inherits directly from dict.
class MyDict(dict):
def __getitem__(self, key):
return super(MyDict, self).__getitem__(key) * 2
d = MyDict(a=5)
print(d['a']) # Returns 10
But the unification is just the tip of the iceberg. Python 2.2 also introduces "Generators" (via the yield keyword). If you’ve ever had to write a custom iterator class with __iter__ and next() methods, generators are going to feel like magic. They allow you to write a function that "remembers" its state between calls, making it incredibly easy to process large datasets without loading everything into memory.
We also get Method Resolution Order (MRO) via the C3 algorithm, which solves the "diamond problem" in multiple inheritance in a consistent way. And "Slots" (__slots__) provide a way to optimize memory for classes with many instances by preventing the creation of a __dict__ for every object.
Python is often criticized for being "slow," but with version 2.2, it’s becoming much more "mature." It’s a language that cares about its internal consistency and its developers' productivity. While others are chasing the "next big thing," Python is steadily becoming the best tool for everything from web dev to scientific computing.
The transition to new-style classes will take time (you still have to explicitly inherit from object to get the new behavior), but the path forward is clear. Python is no longer just a "scripting" language; it's a first-class object-oriented powerhouse.
Aunimeda develops websites and web applications for businesses - corporate sites, e-commerce, portals, and custom platforms.
Contact us to discuss your web project. See also: Web Development, E-commerce Development