On Feb 8, 8:15 pm, Thomas Heller <[EMAIL PROTECTED]> wrote:
> I agree with most of the posters is this thread that it is confusing to spread
> the definition of a class over several places or files.
>
> But, there are cases where the trick come in handy - when classes are created
> not by class sta
Ziga Seilnacht schrieb:
> Thomas Heller wrote:
>>
>> Do you have a pointer to that post?
>>
>
> I think that he was refering to this post:
> http://mail.python.org/pipermail/python-list/2006-December/416241.html
>
> If you are interested in various implementations there is also this:
> http://mai
Martin v. Löwis wrote:
> I'm happy to announce partial 1.0; a module to implement
> partial classes in Python. It is available from
>
> http://cheeseshop.python.org/pypi/partial/1.0
>
> A partial class is a fragment of a class definition;
> partial classes allow to sp
On Feb 8, 4:05 pm, [EMAIL PROTECTED] wrote:>
> Composition is great when you know how largish classes are going to be
> composed ahead of time and/or already have the pieces available in the form
> of other classes you want to reuse. I use this fragment-by-multiple-
> inheritance (I hesitate to ca
Michele> That is a common design, but I don't like it, since it becomes
Michele> very easy to get classes with dozens of methods inherited from
Michele> everywhere, a modern incarnation of the spaghetti-code
Michele> concept. I find it much better to use composition, i.e. to
Mi
On Feb 8, 1:04 pm, [EMAIL PROTECTED] wrote:
> greg> When I want to do this, usually I define the parts as ordinary,
> greg> separate classes, and then define the main class as inheriting
> greg> from all of them.
>
> Agreed. Maybe it's just my feeble brain, but I find this the most
> c
greg> When I want to do this, usually I define the parts as ordinary,
greg> separate classes, and then define the main class as inheriting
greg> from all of them.
Agreed. Maybe it's just my feeble brain, but I find this the most
compelling (and easy to understand) use for multiple in
> Martin v. Löwis schrieb:
>
>>A partial class is a fragment of a class definition;
>>partial classes allow to spread the definition of
>>a class over several modules.
When I want to do this, usually I define the parts
as ordinary, separate classes, and then define the
Thomas Heller wrote:
>
> Do you have a pointer to that post?
>
I think that he was refering to this post:
http://mail.python.org/pipermail/python-list/2006-December/416241.html
If you are interested in various implementations there is also this:
http://mail.python.org/pipermail/python-list/2006-A
Carl Banks schrieb:
> On Feb 7, 10:17 am, "Carl Banks" <[EMAIL PROTECTED]> wrote:
>> On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > Martin v. Löwis schrieb:
>>
>> > > I'm happy to an
On Feb 7, 10:48 am, "Michele Simionato" <[EMAIL PROTECTED]>
wrote:
> > Martin v. Löwis schrieb:
>
> > > I'm happy to announce partial 1.0; a module to implement
> > > partial classes in Python. It is available from
>
> > >http://cheeses
> Martin v. Löwis schrieb:
>
>
>
> > I'm happy to announce partial 1.0; a module to implement
> > partial classes in Python. It is available from
>
> >http://cheeseshop.python.org/pypi/partial/1.0
>
> > A partial class is a fragment of a class defi
On Feb 7, 10:17 am, "Carl Banks" <[EMAIL PROTECTED]> wrote:
> On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote:
>
>
>
> > Martin v. Löwis schrieb:
>
> > > I'm happy to announce partial 1.0; a module to implement
> >
On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote:
> Martin v. Löwis schrieb:
>
> > I'm happy to announce partial 1.0; a module to implement
> > partial classes in Python. It is available from
>
> >http://cheeseshop.python.org/pypi/partial/1.0
&g
Martin v. Löwis schrieb:
> I'm happy to announce partial 1.0; a module to implement
> partial classes in Python. It is available from
>
> http://cheeseshop.python.org/pypi/partial/1.0
>
> A partial class is a fragment of a class definition;
> partial classes allow to sp
anage the complexity I implemented some sort of aspect oriented
programming (perhaps aspect oriented programming is not quite right in
this context...). That is I implemented a mechanism to dynamically add
methods to existing classes. This is similar to the thread "Partial
classes" discuss
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
>>
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 fil
> 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
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,
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.
>
> What the ... is GUI code doing in a domain object ???
It doesn't (shouldn't) really wo
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 experien
> > 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
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
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
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 class
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 t
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 bet
[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
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
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
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
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
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
> 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
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
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
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
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
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
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
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 part
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. Like this
43 matches
Mail list logo