Re: is it possible to dividing up a class in multiple files?

2006-08-08 Thread roelmathys
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > > Regards > Martin you could do this: file_1.py: class A: def __init__(self): self.a = 1 file_2.py: from file_

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Patrick Maupin
Diez B. Roggisch wrote: > Martin Höfling wrote: > > > is it possible to put the methods of a class in different files? I just > > want to order them and try to keep the files small. > > No, its not possible. What you can do is to create several classes and one > that inherits from all of them. > >

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 15:41 +0200, Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > Here's how I do it: Firstly, I create a file called imports.py which contains all my import s

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Martin Höfling
Thanks for your suggestions, precompiling is not an option, cause I can't introduce extra dependencies from a precompiler. > Better yet is to not write huge classes and getting rid of strange > conventions or views that make the problem appear as such. To explain that: > I've never felt the need

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Ant
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. The editor leo (http://webpages.charter.net/edreamleo/front.html) gives you a way of handling large files in this way without actuall

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Bruno Desthuilliers
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. Technically, yes - but in a somewhat hackish way. But you *really* should not have such a need at first. Smells like a design (or co

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Ziga Seilnacht
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > > Regards > Martin You could use something like this: """ Example usage: >>> class Person(object): ... def __init__(self

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread bearophileHUGS
Martin Höfling: > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. Well, you can create one or more modules filled with nude methods, and you can define a class inside another module, and then add the methods to this last

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Chris Johnson
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > > Regards > Martin I ran across pyp the other day. It may be what you're wanting. http://www.freenet.org.nz/python/pyp/ --

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Diez B. Roggisch
Martin Höfling wrote: > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. No, its not possible. What you can do is to create several classes and one that inherits from all of them. Better yet is to not write huge classe

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Michiel Sikma
Hi Martin, I don't think that's possible, since a file is executed when it is imported. If you load a file which contains a "partial" class, you will get an error because the indentation is incorrect, or the methods will be loaded in the wrong namespace. Regards, Michiel Op 7-aug-2006, om

is it possible to dividing up a class in multiple files?

2006-08-07 Thread Martin Höfling
Hi there, is it possible to put the methods of a class in different files? I just want to order them and try to keep the files small. Regards Martin -- http://mail.python.org/mailman/listinfo/python-list