Intro to Python Introspection and Dynamic Programming | Linux Today

Intro to Python Introspection and Dynamic Programming

Written By
Web Webster
Web Webster
Jul 1, 2009

“In this example we have defined a parent class, Device, which
has attributes, and some child classes which contain their
particular attributes. We have created a list of instances of the
devices. In the “for loop” we do something only if the device has
the attribute getEths. Therefore we are using internal information
about the program, i.e. its classes, to control the program’s
behaviour.

“By the way, this is sometimes referred to as “duck typing”. If
it looks like a duck it must be a duck, therefore you can treat it
as a duck.

“Before proceeding, we should note that the Python language has
much similarity to a Python program, in that, everything in the
language is an object. For now we will limit the discussion to
classes and instances of classes. Just remember that Python has
many built in classes, there are hundreds in the “standard”
libraries,and many thousands which can be downloaded and all of the
classes themselves share some common properties.”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.