Classes and Functions - General Questions
johnjsal at NOSPAMgmail.com
Wed Oct 18 22:55:41 CEST 2006
> And have class2 inherit class1 without any import statements, or need
> it be imported first?
> Or need class1 and class2 be both declared in the same .py file if
> there is inheritance?
If the classes are in the same module, you don't need to do any
importing or qualification. If they are in separate modules, you need to
import the necessary module(s) and then you can use its contents.
> 2) Function overloading - is it possible?
> Can I have the following code, or something which acts the same in
> def function(a, b)
> do things
> def function(a, b, c)
> do things only if I get a third argument
I don't know all the details, but you can't do this with Python. One
alternative is to use an arbitrary number of arguments with the *args
More information about the Python-list