Metaprogramming in Python

author photo

Just like metadata is data about data, metaprogramming is writing programs that manipulate programs. It’s a common perception that metaprograms are the programs that generate other programs. But the paradigm is even broader. All of the programs designed to read, analyze, transform, or modify themselves are examples of metaprogramming. Some examples include:

  • Domain-specific languages (DSLs)
  • Parsers
  • Interpreters
  • Compilers
  • Theorem provers
  • Term rewriters

This tutorial explores metaprogramming in Python. It refreshes your Python knowledge with a review of Python’s features so that you can better understand the concepts in this tutorial. It also explains how type in Python has more significance than just to return the class of an object. Then, it discusses ways of metaprogramming in Python and how metaprogramming can simplify certain tasks.

Go to tutorial >> https://www.ibm.com/developerworks/analytics/library/ba-metaprogramming-python/index.html?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

%d bloggers like this: