wxSizer.Remove() assert traceback

I have a panel on which I'm creating controls dynamically. At times I
need to clean the slate, and I'm trying to employ the solution that's in
the wiki FAQ 3.10:

def removeChildren(self, destroy=1):
        """
        Remove all my children components and optionally
        destroy them.
        """
        while self.GetSizer().Remove(0):
            pass
        if destroy:
            self.DestroyChildren()

When I use this on my panel, it appears that instead of Remove(0)
returning a false if the item isn't found, it causes an assertion in the
wx core. Here's the traceback:

C:\WINDOWS\system32\cmd.exe /c reporter.py
Traceback (most recent call last):
  File "C:\Dev\Py\Reporter\reporter.py", line 49, in treeHandler
    self.buildParamControls(data["path"])
  File "C:\Dev\Py\Reporter\reporter.py", line 56, in
buildParamControls
    self.removeChildren(self.param_panel, True)
  File "C:\Dev\Py\Reporter\reporter.py", line 107, in removeChildren
    while ctl.GetSizer().Remove(0):
  File "C:\Python23\Lib\site-packages\wx\core.py", line 8329, in
Remove
    return _core.Sizer_Remove(*args, **kwargs)
wx.core.PyAssertionError: C++ assertion "wxAssertFailure" failed in
..\..\src\common\sizer.cpp(465): Remove index is out of range

I didn't try this sort of code 2.5.1.5, so I'm not sure if it's a
recently introduced problem, or if I'm doing something goofy and don't
know it, etc. Here's an example that causes the traceback here, on
2.5.1.5:

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)

        self.panel = wx.Panel(self, -1)
        sz = wx.BoxSizer(wx.VERTICAL)
        btn = wx.Button(self.panel, -1, "Remove Me")
        sz.Add(btn, proportion = 1, flag = wx.EXPAND)

        self.panel.SetSizer(sz)
        
        self.Bind(wx.EVT_BUTTON, self.click)

    def click(self, evt):
        self.removeChildren(self.panel, True)

    def removeChildren(self, ctl, destroy=1):
        while ctl.GetSizer().Remove(0):
            pass
        if destroy:
            ctl.DestroyChildren()
        
class MyApp(wx.App):
    def OnInit(self):
        self.frame = MyFrame(None, -1, 'Remove Test')
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

def main():
    app = MyApp(0)
    app.MainLoop()

if __name__ == '__main__':
    main()