A Novice Class Question.

Phlip phlip_cpp at yahoo.com
Wed Aug 28 02:16:36 CEST 2002


Mauro wrote:

> Hello to all,
> 
> I was trying to make a function and all right. But when I try to put
> this function below of a class, I'm having some troubles... The
> example is down.
> 
> Conjuntos.py
> 
> class Conjs:
>     def NewList(a = list(), b = list()):

Welcome to Python.

Python is very selfish.

We must always declare every argument, even those which other languages 
imply secretly.

     def NewList(self, a = list(), b = list()):

The first argument refers to the current object.

Another tip: Get it working, and only then give arguments defaults.


-- 
  Phlip
   http://www.greencheese.org/AndNowaNitelyLitelyUrbanOne
  --  Shock Value Added  --




More information about the Python-list mailing list