jim stockford wrote:
> I've gotten red-eyed looking through google pages
> to find answers. I've read the python.org docs and
> tutorials entirely (some parts very quickly).
> 
> If I write a little .py file, its name is __main__
> 
> assuming no big nit-picks in the claim above,
> is __main__ a class?

No, it is a module.

> What exactly does it mean "module" and how
> is that different from a class.

A module corresponds to a single file of source code. A class is...well, 
the object created when you execute a 'class' statement. Classes are 
defined in modules. I'm struggling with this one. How do you see them as 
the same? They both contain and organize functions but the way they are 
used is very different.

> Is it sufficient to define a class as some executable
> code that gets run when it's loaded? Someone has
> so defined, but I don't think it's sufficient.

Any executable code? No. A class is a particular kind of object, created 
(usually) by a class statement.

> classic definition of a function is some code that
> takes arguments and returns a single value. What's
> the definition of a function in python?

That sounds OK.
> 
> how is a method different from a function? Is it
> just that a method is a member of a class, 

Yes.

> i.e. can
> a class have both methods and functions?

A class can have static methods and class methods which are functions 
but not the same as normal methods.

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to