"spir" <denis.s...@free.fr> wrote
is there a way to give arguments to a class definition? Eg
class MonoList(list, typ, number):
item_type = typ
item_number = number
Yes thats what the __init__ method is for.
class MonoList:
def __init__(self, lst, typ, num):
self.item_type = typ
self.number = num
etc...
myList = MonoList([1,2,3], int, 3) # or whatever...
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor