Classes and Functions - General Questions
Setash at gmail.com
Wed Oct 18 21:42:22 CEST 2006
I've got a tiny bit of coding background, but its not the most
That said, I'm trying to wrap my head around python and have a couple
questions with classes and functions.
Two notable questions:
1) Classes. How do you extend classes?
I know its as easy as:
But where does the parent class need to lie? In the same file? Can it
lie in another .py file in the root directory? Can it simply be
accessed via an import statement or just plain jane?
To clarify, as it may be worded poorly:
Can my directory structure look like
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?
I think thats a bit more clear :)
2) Function overloading - is it possible?
Can I have the following code, or something which acts the same in
def function(a, b)
def function(a, b, c)
do things only if I get a third argument
Any thoughts / comments / etc? Just trying to get a solid foundation of
python before going any further.
More information about the Python-list