Ramblings

March 12, 2008

The use of python metaclasses

Filed under: dev, python — michaelangela @ 1:55 pm

I have to say… it was a bit mind blowing but I do see the power. The example given, while dated, is helpful. This was apparently still early on in the development of the concept.

Metaclasses in Python 1.5

Now let’s see how we could use metaclasses — what can we do with metaclasses that we can’t easily do without them? Here’s one idea: a metaclass could automatically insert trace calls for all method calls. Let’s first develop a simplified example, without support for inheritance or other “advanced” Python features (we’ll add those later).

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: