Re: define class over 2 files

2009-08-19 Thread greg
naveen wrote: Is it possible to split up a class definition over multiple files? Not exactly, but you can do variations of this: ... [subclass a class] Multiple inheritance can also be useful: # A_Part1.py class A_Part1: ... # A_Part2.py class A_Part2: ... # A.py from A_Part1

Re: define class over 2 files

2009-08-18 Thread Steven D'Aprano
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

Re: define class over 2 files

2009-08-18 Thread naveen
Is it possible to split up a class definition over multiple files? Not exactly, but you can do variations of this: ... [subclass a class] Steven Thanks Steven. I guess I will just preprocess the script: class.sh cat partA.py class.py cat partB class.py python class.py /class.sh --

Re: define class over 2 files

2009-08-18 Thread Ben Finney
naveen naveen.g...@gmail.com writes: I guess I will just preprocess the script: class.sh cat partA.py class.py cat partB class.py python class.py /class.sh This, to me, is a programming smell; not necessarily bad, but an indicator of bad practice. What is the problem you're trying to

Re: define class over 2 files

2009-08-18 Thread naveen
indicator of bad practice. What is the problem you're trying to solve? Ben Finney No major problem. I was just trying to make some experimental changes to autokey. My repo: http://github.com/tinku99/autokey.git/ Didn't want to subclass or reorganize a class just yet. --

Re: define class over 2 files

2009-08-18 Thread Simon Forman
On Tue, Aug 18, 2009 at 1:57 AM, Steven D'Apranoste...@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

Re: define class over 2 files

2009-08-18 Thread Jan Kaliszewski
18-08-2009 o 06:58:58 Xavier Ho cont...@xavierho.com wrote: On Tue, Aug 18, 2009 at 2:45 PM, naveen naveen.g...@gmail.com wrote: Is it possible to split up a class definition over multiple files? - Answer in short, I don't think so. Why not? - File a.py: class MyClass: def

define class over 2 files

2009-08-17 Thread naveen
Is it possible to split up a class definition over multiple files? -- http://mail.python.org/mailman/listinfo/python-list

Re: define class over 2 files

2009-08-17 Thread Xavier Ho
On Tue, Aug 18, 2009 at 2:45 PM, naveen naveen.g...@gmail.com wrote: Is it possible to split up a class definition over multiple files? - Answer in short, I don't think so. Now why would you want to do that? There is another solution - have a main class for shared methods, and have other