Need help with OOP

Alan Gauld alan.gauld at btinternet.com
Fri Nov 7 03:59:02 EST 2003


On Fri, 7 Nov 2003 05:36:57 +0100, sinisam
<X.3.M__antispam__ at mail.ru> wrote:
> Object oriented programming is not a new term to me, but ...
> I did my share of programming several years ago... 

Don't worry if OOP takes aq while to sink in, thats pretty
common, especially if you've been trained in procedural styule
programming - you have to learn to change your approach to
problem solving.

It might be worth going through some of the beginners 
tutors on the Python web site, most of which - including 
mine! ;-) - have a section on OOP.

> "Make class for the IP address. It should be initialized from the
> string. Later on, we can add functions to it."
> 
> [1] What in the world I have to do here?

Turn an IP address into an OOP object.

> [1a] How to make class for the IP address? What does it mean?

Read the tutorials, they will take you step by step through the
comcepts.

> [2] "Initialization from the string" means something like passing
> arguments from the command line...?

A little bit, but as part of the initialisation call of your
object. Python contains lots of objects. For example files are
objects.

You create a file object by passing the filename as a parameter:

f = file("foo.txt")

f is now a file object that you can maniplulate. You are being
asked to provide a similar facility for IP addresses:

ip = IPaddress("123.234,321.34")

> I started looking for good literature.

Try the beginners tutors and also for the theoretical
understanding visit www.cetus-links.org which is a huge 
OOP portal site.

> P.P.S. Speaking of being illiterate, no, English is not my native 
> language. Just in case someone wanders... :o)

You're doing just fine on that front. Better than some who do ave
English as their native tongue! :-)

Alan G.

Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Python-list mailing list