Classes question
Duncan Booth
duncan at NOSPAMrcp.co.uk
Fri Nov 1 04:17:34 EST 2002
Emmanuel Jeandel <ejeandel at ens-lyon.fr> wrote in
news:20021031205456.GA8006 at ens-lyon.fr:
> I would like to have the class A and the class B in two differents files.
> Is it possible ?
> I think that it is not directly possible, but if there is a mean with a
> small change in the code...
>
Looks straightforward enough to me:
File classA.py:
class A:
def __init__(self):
pass
def f(self):
self.x = classB.B()
import classB
File classB.py:
import classA
class B(classA.A):
def __init__(self):
classA.A.__init__(self)
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list