win32all-142 available (Long)

Carl Caulkett carlca at dircon.co.uk
Sat Jan 5 20:20:44 EST 2002


In article <mailman.1010272507.6806.python-list at python.org>, 
jason at jorendorff.com says...
> #------------------------------------------------------
> > # NEW CODE BEGIN
> > #------------------------------------------------------
> > if hasattr(ob, "__class__"):		
> >     allitems = []
> >     allitems.extend(_get_class_attributes(ob.__class__))
> >     for item in allitems:
> >         if not item in items:
> >             items = items + item
> 
> I think you probably mean this.
> 
> if hasattr(ob, "__class__"):
>     for item in _get_class_attributes(ob.__class__):
>         if item not in items:
>             items.append(item)

Your version is much more elegant, but, I'm sure that you would concede, 
functionally identical. In my defense, I was so excited at having found 
and fixed this (I am a recently converted Python devotee) that I 
neglected to put the code through my usual rigorous 3 day "before 
hitting the send button" refactoring session.

:^)

-- 
Carl



More information about the Python-list mailing list