A tiny weirdness in pyshellslices

wx.version()
'2.8.11.0 (msw-unicode)' # WinXP SP3 32bit

sys.version
'2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]'

I've noticed something I can not explain within pyslices.

If I run this script in pyslices I consistantly get a just one line of
output with three 'EVT_'... strings. How is that possible with a
modulus of 2? And I do not get this single weirdness if I run the same
script in python.exe

TestScript.py

import wx

print('Expand console window to well over 120 characters wide.')

count = 0
for i in dir(wx):
    count = count + 1
    if 'EVT_' in i:
        print '%40s'%i, # note the comma at end
        if count % 2 == 0:
            print count

See my following reply for a screen image.

Here is a screen shot of a cmd.exe console window and a pyslice window.

pyshell_weirdness.png

DevPlayer wrote:

I've noticed something I can not explain within pyslices.

If I run this script in pyslices I consistantly get a just one line of
output with three 'EVT_'... strings. How is that possible with a
modulus of 2? And I do not get this single weirdness if I run the same
script in python.exe

I can explain it. You bump "count" on every symbol, but you only check
evenness/oddness when you print one. So, when you get a non EVT_ symbol
in the list, it messes up your counting. If, for example, every other
symbol included EVT_, then they would all print on a single line.

If you want to keep a running count AND make sure you only get two on a
line, you'll need two counts.

    count = 0
    toggle = 0
    for i in dir(wx):
        count += 1
        if 'EVT_' in i:
            print "%40s" % i,
            toggle = 1 - toggle
            if not toggle:
                print count

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

I'll try that. Still confusing though, is why do I get different
results from the same wx package between PySlices and python.exe?
Seems PySlices must be adding more to dir(wx).

This code yields the correct results in both interfaces; python.exe
and PySlices

I'll presume there must be something added by PySlices; I thought it
was funny though, that the results in PySlices showed just that one
single anomoly throughout the several thousand items in dir(wx).

Anyway thanks.

···

On Nov 21, 1:08 pm, Tim Roberts <t...@probo.com> wrote:

I can explain it. You bump "count" on every symbol, ...,
you'll need two counts.

count = 0
toggle = 0
for i in dir\(wx\):
    count \+= 1
    if &#39;EVT\_&#39; in i:
        print &quot;%40s&quot; % i,
        toggle = 1 \- toggle
        if not toggle:
            print count

Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.