Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes

Reply
Thread Tools

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes

 
 
Ian Kelly
Guest
Posts: n/a
 
      12-12-2012
On Wed, Dec 12, 2012 at 12:20 PM, Dave Cinege <(E-Mail Removed)> wrote:
> On Tuesday 11 December 2012 01:41:38 Ian Kelly wrote:
>
>> I have a few critiques on the code. First, you might want to use
>> __getattribute__ instead of __getattr__. Otherwise you'll end up

>
> File "/home/dcinege/src/thesaurus/thesaurus.py", line 84, in
> __getattribute__
> return self.__getitem__(name)
> RuntimeError: maximum recursion depth exceeded while calling a Python object
>
> This takes me into the same hell as when I was trying to implement this as a
> class. Someone else would have to take the time to do this. __getattr__ doing
> what I expect it to do, for what i do.


def __getattribute__(self, name):
if name.startswith('__') and name.endswith('__'):
return super(Thesaurus, self).__getattribute__(name)
return self.__getitem__(name)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes Ian Kelly Python 0 12-11-2012 10:20 PM
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes Ian Kelly Python 0 12-11-2012 09:53 PM
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes Dave Cinege Python 0 12-11-2012 08:57 PM
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes Ian Kelly Python 0 12-11-2012 06:41 AM
Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass usingattributes Jason Friedman Python 0 12-11-2012 04:08 AM



Advertisments