python without OO
craig at postnewspapers.com.au
Thu Jan 27 01:27:19 EST 2005
On Wed, 2005-01-26 at 22:28 -0500, Davor wrote:
> I browsed docs a bit today, and they also confirm what I have believed -
> that OO is totally secondary in Python. In fact,
> object/classes/metaclasses are nothing but *dictionaries with identity*
> in python. Love this approach.
I was really impressed with the design of the language, especially this
bit. I first "got" it when reading Learning Python 2nd Ed (well *after*
I'd been using Python for a while, but it's always good to read even
intro books to fill out "obvious" things you might've missed). I love
the way the same "It's just a dictionary search" principle applies to
inheritance, scoped variable lookups, etc.
In Python, even metaclasses just operate on the class dictionary. How
pleasantly simple :-) - especially how the step from class factory to
metaclass is so small and approachable.
I also love the way I can chuck a bunch of objects into a functionally
styled processing pipeline, say a series of functions that each just
return the result of a listcomp/genexp.
More information about the Python-list