Re: Partial classes

2006-07-20 Thread Bruno Desthuilliers
Stefan Behnel wrote: > Kay Schluehr wrote: > >>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

Re: Partial classes

2006-07-19 Thread Stefan Behnel
Kay Schluehr wrote: > 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 h

Re: Partial classes

2006-07-19 Thread 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

Re: Partial classes

2006-07-19 Thread Michele Simionato
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

Re: Partial classes

2006-07-19 Thread Rob Williscroft
Bruno Desthuilliers wrote in news:[EMAIL PROTECTED] in comp.lang.python: > 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

Re: Partial classes

2006-07-19 Thread John Salerno
Bruno Desthuilliers wrote: > 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 y

Re: Partial classes

2006-07-19 Thread Sanjay
> > Class PersonBO(Person): > > def Block(): > > blocked = True > > > shouldn't it be: > class PersonBO(Person): > def block(self): > self.blocked = True > Yes, it should be as you mentioned. However, I had posted it to elaborate the case. Actually, I tested using the follow

Re: Partial classes

2006-07-19 Thread Kay Schluehr
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 cod

Re: Partial classes

2006-07-19 Thread Bruno Desthuilliers
Sanjay 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? > > > I have to study about metaclass and see whether this can be handled. It > seemed inheritence is not working. > > PROBLEM: Separating plumbing code and b

Re: Partial classes

2006-07-19 Thread Bruno Desthuilliers
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 co

Re: Partial classes

2006-07-19 Thread John Salerno
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. B

Re: Partial classes

2006-07-19 Thread [EMAIL PROTECTED]
Kay Schluehr wrote: > This definition lacks a check for disjointness of the parts. No two > partial classes shall contain a method with the same name. Yes - I mentioned at the bottom that the last one evaluated will overwrite any existing one. You're right that its probably a better idea to che

Re: Partial classes

2006-07-19 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > Sanjay wrote: > > Hi All, > > > > Not being able to figure out how are partial classes coded in Python. > > > > Example: Suppose I have a code generator which generates part of a > > business class, where as the custome part is to be written by me. In > > ruby (or C#), I

Re: Partial classes

2006-07-19 Thread Sanjay
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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread Bruno Desthuilliers
Kay Schluehr wrote: > Bruno Desthuilliers wrote: > >>Sanjay wrote: >> >>>Hi Alex, >>> >>>Thanks for the input. >>> >>>Being new to Python, and after having selected Python in comparison to >>>ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should >>>be an obvious and easy to imple

Re: Partial classes

2006-07-19 Thread [EMAIL PROTECTED]
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files. Li

Re: Partial classes

2006-07-19 Thread Kay Schluehr
Bruno Desthuilliers wrote: > Sanjay wrote: > > Hi Alex, > > > > Thanks for the input. > > > > Being new to Python, and after having selected Python in comparison to > > ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should > > be an obvious and easy to implement feature and must

Re: Partial classes

2006-07-19 Thread Bruno Desthuilliers
Sanjay wrote: > Hi Alex, > > Thanks for the input. > > Being new to Python, and after having selected Python in comparison to > ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should > be an obvious and easy to implement feature and must be, if not already > have been, planned in

Re: Partial classes

2006-07-19 Thread Sanjay
> 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? I have to study about metaclass and see whether this can be handled. It seemed inheritence is not working. PROBLEM: Separating plumbing code and business logic while using S

Re: Partial classes

2006-07-19 Thread Peter Otten
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files.

Re: Partial classes

2006-07-19 Thread Daniel Dittmar
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files.

Re: Partial classes

2006-07-19 Thread Dave Benjamin
On Wed, 18 Jul 2006, Sanjay wrote: > What is the equivalent in Python? Inheriting is a way, but is not > working in all scenerios. Have you tried multiple inheritance? For example: from GeneratedPerson import GeneratedPerson from HandcraftedPerson import HandcraftedPerson class Person(Generated

Re: Partial classes

2006-07-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Sanjay wrote: > Being new to Python, and after having selected Python in comparison to > ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should > be an obvious and easy to implement feature and must be, if not already > have been, planned in future releases

Re: Partial classes

2006-07-19 Thread Sanjay
Hi Alex, Thanks for the input. Being new to Python, and after having selected Python in comparison to ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should be an obvious and easy to implement feature and must be, if not already have been, planned in future releases of Python. W

Re: Partial classes

2006-07-18 Thread Kay Schluehr
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files. L

Re: Partial classes

2006-07-18 Thread alex23
Sanjay wrote: > Not being able to figure out how are partial classes coded in Python. Hi Sanjay, To the best of my knowledge, Python currently has no support for partial classes. However, BOO (http://boo.codehaus.org/) - which is a Python-like language for the .NET CLI)- _does_ support partial c