Partial classes

Michele Simionato michele.simionato at gmail.com
Thu Jul 20 00:21:02 EDT 2006


Sanjay ha scritto:

> Thanks for the code showing how to implement partial classes. Infact, I
> was searching for this code pattern. I will have a study on metaclass
> and then try it.
>
> Thanks
> Sanjay

Anyway, I would suggest you NOT to use this code in production. Yes,
Python
can imitate Ruby, but using this kind of classes would confuse
everybody and
make your code extremely unpythonic. As always, consider changing your
mindset,
when you switch language. For you problem, you could just put your
client
methods in a file, and add them to your original class with setattr, if
you don't
want to use inheritance. It would be still better that magically
transform your
classes with a metaclass.

                    Michele Simionato




More information about the Python-list mailing list