CFO: PyAssertionError in Phoenix

Hi all,

Most of you probably know that most of the times that that there was need for a Python specific version of some class or function in addition to the wrapped C++ one that they are named wx.PySomething. That naming pattern was also used for most things that were only in wxPython and not in C++. This all started back before there was a "wx" package name, and so they were all really wxPySomething and the "wxPy" meant that it is for "wxPython".

That was a good standard, and most of the time it was still good even after the Great Renaming that came with switching to the wx package. But there was one that has bugged me since then, and that is wx.PyAssertionError. Because if you look at it without the prefix it is just "PyAssertionError" and from the name that would make me think that it is a Python error. But it isn't. It's an exception raised in response to a wxWidgets assertion, so I've been thinking of changing the name in Phoenix to be WxAssertionError. I can also add an alias named PyAssertionError to help the transition, but I don't think I can get it to raise a deprecation warning because of how exception classes work.

Thoughts? Opinions?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org

Hi Robin,

···

On 12 November 2011 00:50, Robin Dunn wrote:

Hi all,

Most of you probably know that most of the times that that there was need
for a Python specific version of some class or function in addition to the
wrapped C++ one that they are named wx.PySomething. That naming pattern was
also used for most things that were only in wxPython and not in C++. This
all started back before there was a "wx" package name, and so they were all
really wxPySomething and the "wxPy" meant that it is for "wxPython".

That was a good standard, and most of the time it was still good even after
the Great Renaming that came with switching to the wx package. But there was
one that has bugged me since then, and that is wx.PyAssertionError. Because
if you look at it without the prefix it is just "PyAssertionError" and from
the name that would make me think that it is a Python error. But it isn't.
It's an exception raised in response to a wxWidgets assertion, so I've been
thinking of changing the name in Phoenix to be WxAssertionError. I can also
add an alias named PyAssertionError to help the transition, but I don't
think I can get it to raise a deprecation warning because of how exception
classes work.

Thoughts? Opinions?

I am not sure it is a big issue overall; I can of course speak only
for myself, and I don't remember catching so many instances of
wx.PyAssertionError in my code overall (6 instances of its use on 2.04
million lines of Python code).

As for wxPython, 2.9.2.4 has only the following instances:

wx.lib
------

wx\lib\inspection.py(395) except wx.PyAssertionError:
wx\lib\langlistctrl.py(277) except wx.PyAssertionError:

Editra
------

wx\tools\editra\src\ed_main.py(365) except wx.PyAssertionError:
wx\tools\editra\src\ed_statbar.py(114) except
wx.PyDeadObjectError, wx.PyAssertionError:
wx\tools\editra\src\util.py(89) except
wx.PyAssertionError, msg:
wx\tools\editra\src\util.py(119) except wx.PyAssertionError:
wx\tools\editra\src\util.py(185) except wx.PyAssertionError:
wx\tools\editra\src\util.py(218) except
wx.PyAssertionError, msg:
wx\tools\editra\src\eclib\pstatbar.py(252) except wx.PyAssertionError:
wx\tools\editra\src\extern\flatnotebook.py(874) except wx.PyAssertionError:

Demos
-----

BitmapButton.py(26) except wx.PyAssertionError:
GridBagSizer.py(111) except wx.PyAssertionError:
MimeTypesManager.py(201) except wx.PyAssertionError:

So I guess most of the work will need to be done by Cody :wink: .
Although this is only 8 lines of code to change in the entire Editra
folder tree.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

That was a good standard, and most of the time it was still good even after
the Great Renaming that came with switching to the wx package. But there was
one that has bugged me since then, and that is wx.PyAssertionError. Because
if you look at it without the prefix it is just "PyAssertionError" and from
the name that would make me think that it is a Python error. But it isn't.
It's an exception raised in response to a wxWidgets assertion, so I've been
thinking of changing the name in Phoenix to be WxAssertionError. I can also
add an alias named PyAssertionError to help the transition, but I don't
think I can get it to raise a deprecation warning because of how exception
classes work

IMO Provide the new name with alias to the old name, but I don't think
you can ever take it away because by their very nature that code will
be rarely trodden.

···

On 12 November 2011 00:50, Robin Dunn wrote:

On 15 November 2011 13:25, Andrea Gavana <andrea.gavana@gmail.com> wrote:

wx\tools\editra\src\ed_statbar.py(114) except
wx.PyDeadObjectError, wx.PyAssertionError:

Looks like Cody needs to change that right away or else
wx.PyAssertionError will be replace with an instance of
wx.PyDeadObjectError.

Sam

Hi Robin,

···

2011/11/12 Robin Dunn <robin@alldunn.com>:

It's an exception raised in response to a wxWidgets assertion, so I've been
thinking of changing the name in Phoenix to be WxAssertionError.

We're catching PyAssertionError only 5 times in the Task Coach source
code (120KLOC Python), so just do what is most convenient for you.

Cheers, Frank