[Tutor] Language truce

Patrick K. O'Brien pobrien@orbtech.com
Thu, 28 Jun 2001 15:56:05 -0500


>From the Python Tutorial:

9.7 Odds and Ends
Sometimes it is useful to have a data type similar to the Pascal ``record''
or C ``struct'', bundling together a couple of named data items. An empty
class definition will do nicely, e.g.:
class Employee:
    pass

john = Employee() # Create an empty employee record

# Fill the fields of the record
john.name = 'John Doe'
john.dept = 'computer lab'
john.salary = 1000
A piece of Python code that expects a particular abstract data type can
often be passed a class that emulates the methods of that data type instead.
For instance, if you have a function that formats some data from a file
object, you can define a class with methods read() and readline() that gets
the data from a string buffer instead, and pass it as an argument.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."

-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Michael Powe
Sent: Thursday, June 28, 2001 1:05 PM
To: tutor@python.org
Subject: Re: [Tutor] Language truce

>>>>> "Israel" == Israel Evans <israel@lith.com> writes:

    Israel> What exactly IS the Python Programming Paradigm---(PPP) :)
    Israel> ???

    Israel> Everything is Beautiful and Easy.

    Israel> Strolling Leisurely towards Nirvana?

Would that it were so.

A couple things I mentioned, like you can't increment through loops.
But, also, it occurs to me that another part of the paradigm appears
to be that you can't create new data types, aka structs in C.

mp

--
  Michael Powe                                 Portland, Oregon USA
'Unless we approve your idea, it will not be permitted, it will not be
allowed.'  -- Hilary Rosen, President, Recording Industry Association
of America

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor