Partial classes

Kay Schluehr kay.schluehr at gmx.net
Wed Jul 19 10:39:20 EDT 2006


John Salerno wrote:
> Marc 'BlackJack' Rintsch wrote:
>
> > Can you flesh out your use case a little bit and tell why you can't solve
> > the problem with inheritance or a meta class?
>
>  From my experience with C#, the only real use for partial classes is
> when you want to separate your GUI code from the rest of your logic. But
> since GUI programming in Python isn't always done, this isn't as big of
> a deal.

Experiences have the tendency to differ.

What about letting your teammates editing certain data-structures in
different files ( physical modules ) but using them in a uniform way
and enable a single access point. If you have partial classes there is
no reason why your team has to share a large file where they have to
edit a single class but break the class into different parts and edit
the parts separately. No one has to care for including any module
because the CLR fits all partial classes together at compile time. I
find this quite amazing.

> Aside from that, if you really need to split up your classes, it's
> probably an indication that you could create multiple classes instead,
> right?

Just infrastructure overhead. I thought people are Pythonistas here and
not Java minds?




More information about the Python-list mailing list