win32all-142 available (Long)

Carl Caulkett carlca at dircon.co.uk
Sun Jan 6 09:28:51 EST 2002


In article <mailman.1010292968.32245.python-list at python.org>, 
jason at jorendorff.com says...

> I was just worried about
> 
>   items = items + item
> 
> This is an error, if (as it seems) "items" is a list and "item"
> is a string.

You're right of course. The confusing thing was that PythonWin behaved 
correctly after applying this "fix". After further investigation I have 
found that the code is indeed failing at this point, but the exception 
is caught by a try except. The implication of this is that this code 
does not make any difference which is indeed what I found after 
commenting the code out altogether. Interestingly, I have found that if 
I comment out the same block of code in view.py in the 2.1 version of 
PythonWin, the code completion fails altogether, which, given that 
view.py is identical under PythonWin 2.1 and PythonWin 2.2, suggests a 
change in behaviour in the underlying Python.

<quick check later using Python console>

Aha! It seems that under Python 2.2, dir(obj), when applied to a class 
returns attributes for ancestor classes whereas in 2.1 it doesn't:

Python 2.2 (#28, Dec 21 2001, 12:21:2
Type "help", "copyright", "credits" o
>>> class a:
...     a = 23
...
>>> class b(a):
...     b = 46
...
>>> dir(b)
['__doc__', '__module__', 'a', 'b']
>>>


ActivePython 2.1.1, build 212 (A
Python 2.1.1 (#20, Jul 26 2001,
Type "copyright", "credits" or "
>>> class a:
...     a = 23
...
>>> class b(a):
...     b = 46
...
>>> dir(b)
['__doc__', '__module__', 'b']
>>>

I assume this is by design, although I cannot find any mention of it in 
the 2.2 docs. Comments?

-- 
Cheers,
Carl



More information about the Python-list mailing list