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_
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.
>
>
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
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
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
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
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
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
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/
--
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
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
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
12 matches
Mail list logo