Don't understand wxPython ids

Roger Binns rogerb at rogerbinns.com
Thu Apr 29 22:26:20 EDT 2004


Greg Ewing wrote:
> Giving an identifier to a command so that it can be
> invoked in multiple ways is a good idea, but it would
> be much more Pythonic if a *name* could be used as the
> identifier rather than a number.

That is kinda what my code is doing :-)  The name just
happens to be a static class member mapped to an integer.

> Use of a number here seems to be entirely the result
> of blindly carrying over a feature of the C++-oriented
> API into Python.

There has been much debate about this on the wxPython lists.
One school of thought is to make wxPython as "Pythonic" as
possible, with its own set of documentation and own
community.  The fact that there is a C++ library underneath
would be a minor implementation detail.

A second school of thought (to which I belong) is that wxPython
should stick to the C++ API closely unless changes significantly
improve developer productivity.  The means that wxPython
remains a member of the wxWidgets community, the standard
wxWidgets documentation remains the same and appropriate,
and it is easy to translate C++/Perl/other language wxWidgets
programs into wxPython and vice versa even for the people
who do not know the languages.

Of course there is no "right answer" as to what is best,
and ultimately it is up to Robin and his good taste.  At
the moment wxPython is largely in the second camp, with
some amount of the former present.  Some people have
implemented stuff in the former camp on top of wxPython
(eg wax).

People are of course welcome to criticise wxWidgets, but
as someone who as actually done programs on multiple
different platforms and GUI toolkits, I am very impressed.
I'll listen to people who have actually written something
that runs on several platforms and operating systems first.

Roger





More information about the Python-list mailing list