[Tutor] Problem with creating a class to access a 2d array

Alan Gauld alan.gauld at btinternet.com
Sat Aug 23 10:52:22 CEST 2008

"lawful falafel" <lawfulfalafel at gmail.com> wrote

> I really like python, but the one thing I really hate is that most 
> of the
> tutorials treat it like interactive scripting instead of object 
> oriented
> development, which really confuses me.

Can you explain what confuses you about that?
The original Object Oriented languages (aside from Simula) were
nearly all interactive, interpreted languages with promt driven
development similar to Python - look at Lisp, SmallTalk etc.
So Object Oriented Development is very amenable to using an
interactive prompt (or workspace in Smalltalk terms).

OO development is all about building objects (via classes)
and testing them. When you have enough objects you glue
them together into a bigger object and so on. Evolving objects
using a prompt is one of the fastest and most effective ways
of building objects that I know.

> know what equivelent version of main() I would write.

You donl;t need a main. In fact main is an artifact of C that
got carried into C++ and Java but is not at all related to OOP.
Many OOP purists would maintain that a main() method/function
is non OOP. You should just need to instantiate the
application and it will start running itself. You can do that in
Python if you want, or you can write a main() function if you
prefer that.

> how I could write an accessing method so that I could write 
> Map(1,2), since
> the only place that deals with arguments is the __init__ function I 
> think,

No, any method can take arguments.

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list