define class over 2 files

Simon Forman sajmikins at gmail.com
Tue Aug 18 22:37:21 CEST 2009


On Tue, Aug 18, 2009 at 1:57 AM, Steven
D'Aprano<steven at remove.this.cybersource.com.au> wrote:
> On Mon, 17 Aug 2009 21:45:57 -0700, naveen wrote:
>
>> Is it possible to split up a class definition over multiple files?
>
> Not exactly, but you can do variations of this:
>
>
> In file A.py, create:
>
> class Parent:
>    def method(self):
>        return "Method"
>
>
> In file B.py, do this:
>
> import A
> class Child(B.parent):

class Child(A.Parent):



More information about the Python-list mailing list