A wx error not recognized by Python

Hi,

w2k sp4, Py241, wxPy261

When I reviewed the code of one of my apps, I noticed I wrote
a statement like this,

     def OnPaint(self, event):
         dc = wx.wx.BufferedPaintDC(self, self.BufferBmp)
              ^^^^^^

To my suprise, the app was and is still perfectly working!
Python has never complained about this.

I opened my psi shell and made some short tests:

>>> import wx
>>> wx.RED
>>> (255, 0, 0)

this is expected. Strangely, the following is also working!

>>> wx.RED
>>> wx.wx.RED
>>> wx.wx.wx.RED
>>> wx.wx.wx.wx.RED

I looks like the regular expression "wx." is just replaced by the "wx" string or is the "import wx" just recursive?

Quid?

Jean-Michel Fauth, Switzerland

You'll find a fair amount of modules that have this same behavior.
It's mostly because of some re-mapping stuff that wx does so that
"import wx" actually finds wx-2.6.1-msw-unicode or whatever. The short
version is that yes, the module wx contains itself recusively.

···

On 9/28/05, jmf <jfauth@bluewin.ch> wrote:

Hi,

w2k sp4, Py241, wxPy261

When I reviewed the code of one of my apps, I noticed I wrote
a statement like this,

     def OnPaint(self, event):
         dc = wx.wx.BufferedPaintDC(self, self.BufferBmp)
              ^^^^^^

To my suprise, the app was and is still perfectly working!
Python has never complained about this.

I opened my psi shell and made some short tests:

>>> import wx
>>> wx.RED
>>> (255, 0, 0)

this is expected. Strangely, the following is also working!

>>> wx.RED
>>> wx.wx.RED
>>> wx.wx.wx.RED
>>> wx.wx.wx.RED
>>> wx.wx.wx.wx.RED

I looks like the regular expression "wx." is just replaced by the "wx"
string or is the "import wx" just recursive?

Quid?

Jean-Michel Fauth, Switzerland