[Tutor] General programming questions

Matt Williams matthew.williams at cancer.org.uk
Thu Oct 27 09:05:51 CEST 2005

Dear List,

I've got a few general programming (not really specific to python,
although you're all so helpful, I thought I'd ask here). I understand
some of these are a bit long, so if you could just point me to some
resources, I'd be very grateful.

1: I need to create objects that have variable levels of behaviour
(controlled perhaps by a .config file). I can do the file reading, etc.
- but how do I implement the behaviour, apart from just re-writing all
the functions for each config level?

2: I need to implement polmorphism in some methods (and a constructor).
At the moment, I have something like:

def __init__ (self, a, b, c):
	if type(a) == type("a")
	elif type(a) == type(["a"])

I'm sure there must be a better way to do this (both the polymorphism
and the type testing) - but I don't know how to do it.

Thanks a lot,


Dr. M. Williams MRCP(UK)
Clinical Research Fellow
Cancer Research UK
+44 (0)207 269 2953
+44 (0)7384 899570

More information about the Tutor mailing list