A First Look at Python Classes | Linux Today

A First Look at Python Classes

Written By
Web Webster
Web Webster
Jul 29, 2009

“C has a feature called a ‘struct’. Struct allows a group of
variable assignments, of different data types, to be collected
under a single name. The variables can be pointers to functions.
Many ‘instances’ can be declared of a struct. The instance can be
referred to by a pointer. The pointers can be stored in arrays. The
structs can contain other structs.

“C++, and later Java, expanded the functionality of a struct in
something called a class. Among other things, functions (methods),
could now be part of a class. And the concept of ‘private’ data was
created. Then languages like Python, Ruby and PHP relaxed the
strict definitions of what a class should or has to be. The result
is that today, we have a very useful mechanism or structure called
a class, with commonality between languages.

“This article will explore the mechanics of classes in Python.
It will not discuss the whole theory of object oriented
programming. This article may serve, if you come from a C
backround, to show that a class is just an enhanced struct.”


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.