473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

<method-wrapper>.__self__

What's the difference between a built-in method and a method-wrapper
object? Why has only the former a __self__, even though both are
tied to the object on which to perform the operation?
Why do list.pop and list.__len__ have different types at all?
[5].pop.__self__ [5] [5].__len__.__self__ Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'method-wrapper' object has no attribute '__self__'
[5].pop <built-in method pop of list object at 0x1c3770> [5].__len__ <method-wrapper object at 0x1bf210>
list.pop <method 'pop' of 'list' objects> list.__len__

<slot wrapper '__len__' of 'list' objects>

--
Hallvard
Jul 18 '05 #1
2 3215
Hallvard B Furuseth <h.**********@usit.uio.no> writes:
What's the difference between a built-in method and a method-wrapper
object?
I *think* method-wrapper's are wrappers around type methods, aka
tp_wotsit slots at the C level. builtin-methods are, well, builtin
methods, similar to method's on regular Python classes but implemented
in C.
Why has only the former a __self__, even though both are tied to the
object on which to perform the operation?
Because.

Probably an oversight.
Why do list.pop and list.__len__ have different types at all?


Well, because they do :-) See above.

If you want to really dig into this sort of thing, you're going to
need to read some source.

Cheers,
mwh

--
Windows 2000: Smaller cow. Just as much crap.
-- Jim's pedigree of operating systems, asr
Jul 18 '05 #2
Michael Hudson wrote:
Hallvard B Furuseth <h.**********@usit.uio.no> writes:
What's the difference between a built-in method and a method-wrapper
object?


I *think* method-wrapper's are wrappers around type methods, aka
tp_wotsit slots at the C level. builtin-methods are, well, builtin
methods, similar to method's on regular Python classes but implemented
in C.
(...)
If you want to really dig into this sort of thing, you're going to
need to read some source.


Thanks.
I think I'll file it as a doc bug instead. Someone else can decide if
it's more than that:-)

--
Hallvard
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Derek Fountain | last post by:
Just asked a question regarding this little bit of XSL: --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> ...
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
1
by: Tomas | last post by:
Is there any sequence diagram on the web that clearly shows in which order all Page methods (load, render and so on) are being called compared to the order the page's contained control methods are...
2
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
0
by: Chinns Arumugam | last post by:
Hello folks, I'm getting following error message in the reference.vb (created using add web feature of VS.Net) when invoking the our vendor web service which was created using Soap Toolkit 1.0. ...
4
by: David Lozzi | last post by:
Howdy, I'm using a WYSIWYG editor called TinyMCE. When I edit some text and then save it back to my SQL server using a SQLCommand, all HTML characters are changed to HTML code, i.e. &gt;strong&lt;...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
0
by: nappingcub | last post by:
This is my first time coding a web service in .NET and ran into a slight snag that I was hoping that anyone could help me out on. I'm using the generic Hello World web service that is stubbed out on...
0
by: Steve K. | last post by:
I need to generate in memory xml to pass to a web service method. VS did not generate proxies for the objects that are needed for these web methods. I'm spoiled, I've used many web services but...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.