It's worth pointing out that this syntax only works in Python 2.3. Prior
to that, the "in" operator in strings could only be used to search for one
character at a time.
This works back to 2.1:
[x for x in dir(wx) if x.find("EVT_SIZ") >= 0]
···
On Wed, 12 Nov 2003 09:07:45 +0100, "David Brown" <david_brown@hotpop.com> wrote:
I dislike the idea of using strings to identify functionality in the way you
suggest. Although python will not spot mistakes like wx.EVT_SIZ at
"compile" time, tools like pychecker can, while they have no chance with
"siz" vs. "size". You can also get more information from a python shell -
if you can't remember whether it should be wx.EVT_SIZ or wx.EVT_SIZE, you
can open a python shell and typeimport wx
[x for x in dir(wx) if "EVT_SIZ" in x]['EVT_SIZE', 'wxEVT_SIZE']
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.