What is a "method-wrapper" object?

R

Roy Smith

I had a class called rule and a subclass of rule, called bgpRule, in a
file called bgp.py.

I decided to move the rule class to its own file, called rule.py. The
original file did "import rule". I forgot to change bgpRule's
__init__() method from calling rule.__init__() to call
rule.rule.__init__().

Amazingly, this caused no immediate error, but rule.__init__() never got
called. When I found the problem, I was puzzled as to why I didn't just
get AttributeError when I called rule.__init__(). A little
investigation led to this:

[rsmith@qwerky agent]$ py
Python 2.2.2 (#1, Apr 5 2003, 13:59:12)
[GCC 3.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.['__builtins__', '__doc__', '__file__', '__name__', 'rule', 'target',
'time']
So, what is this "method-wrapper" thingie that doesn't show up in the
module's dir()? I don't see any mention of it in the on-line
documentation. Have I stumbled upon one of those deep dark Python
secrets that mere mortals aren't supposed to know about?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top