python without OO

Nick Coghlan ncoghlan at iinet.net.au
Thu Jan 27 05:31:20 EST 2005


Davor wrote:
> data structures
 > and
 > functions that operate on these data structures

Eh? What do you think a class is?

Py> data = range(10)
Py> list.extend(data, range(5))
Py> list.sort(data)
Py> print data
[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9]

The fact that data.extend(range(5)) and data.sort() are alternative spellings 
for the second and third lines doesn't change the fact that a class is just a 
data structure grouped with a bunch of functions that operate on that data 
structure.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list