Re: Contains/equals

2010-08-19 Thread Karsten Wutzke
On Aug 19, 4:47 pm, Peter Otten <__pete...@web.de> wrote: > Karsten Wutzke wrote: > > I have an object which has a list of other complex objects. How do I > > best achieve a complex "contains" comparison based on the object's > > class? In Java terms, I&#x

Contains/equals

2010-08-19 Thread Karsten Wutzke
Hello, I have an object which has a list of other complex objects. How do I best achieve a complex "contains" comparison based on the object's class? In Java terms, I'm looking for an equivalent to equals(Object) in Python. Does a similar thing exist? Directions appreciated. Karsten -- http://ma

Re: Constructor call in the same class?

2010-07-25 Thread Karsten Wutzke
> > You have to create your dict somewhere else. You can either set it from > outside: > > class Enum(RootFragment): >     ... > > Enum._jpaTypes = { ... } > THANKS for the quick help. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Constructor call in the same class?

2010-07-25 Thread Karsten Wutzke
What's wrong with: class Enum(RootFragment): __jpaTypes = { # complete! 'CascadeType': Enum("javax.persistence.CascadeType"), 'DiscriminatorType': Enum("javax.persistence.DiscriminatorType"), 'EnumType': Enum("javax.persistence.EnumType"), 'FetchType': E

Re: Visitor pattern and separating iteration

2010-07-23 Thread Karsten Wutzke
On 22 Jul., 22:25, Ian wrote: > Hi Karsten, > > On 22/07/2010 12:03, Karsten Wutzke wrote:> What is it I'm missing? > > I think you are making it more complicated than it really is. > > The visitor pattern is about bringing all the little bits that would > otherw

Re: Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
>         # "public final" >         modifierString = "" > >         i = 0 > >         for modifier in method.getModifiers(): >             if i > 0: >                 modifierString += " " >             modifierString += modifier > >             i += 1 > And please don't comment on the code itsel

Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
Hello, I'm referring to http://groups.google.com/group/comp.lang.python/browse_thread/thread/4f9ba9816fe4fd55# I'm currently implementing what looks like a promising solution. I have one problem though. My code generator isn't awfully complex, but still I have problems trying to figure out where

Re: Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
> > Yes, typo, I meant strictly. > Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
On 15 Jul., 20:28, Thomas Jollans wrote: > On 07/15/2010 07:58 PM, Karsten Wutzke wrote: > > > Hello, > > > this is obviously a Python OO question: > > > Since Python isn't stringly typed, > > I expect this is an innocent typo, and you mean strictly. >

Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
Hello, this is obviously a Python OO question: Since Python isn't stringly typed, single-dispatch isn't available per se. So is the "double-dispatch" Visitor pattern, which is usually used in OO systems to implement code generators. So, what is the de facto method in Python to handle source code

Re: Extending objects by a method?

2010-07-15 Thread Karsten Wutzke
Small correction: I probably have to add a method to a class, so that every object instantiated not by me has the desired functionality. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Extending objects by a method?

2010-07-15 Thread Karsten Wutzke
Hello, I'm new to Python so beware. I have a hierarchical object structure which I iterate over (the elements/classes of interest). I would like to apply the Visitor pattern onto this object structure, so I must add an "accept" method to every object (I'm interesting in) for the Visitor pattern t

Re: The Modernization of Emacs

2007-06-21 Thread Karsten Wutzke
On 17 Jun., 17:13, Xah Lee <[EMAIL PROTECTED]> wrote: Yaawn! > Xah > [EMAIL PROTECTED] > ∑http://xahlee.org/ Hmm I just had to think about the C64/Amiga etc. game "California Games"... The game displayed a comment when the player broke his neck the 13th time when BMXing: "Geek of the week!"