[merge] python 2.5 fixes
james at jamesh.id.au
Tue Sep 26 08:11:59 BST 2006
On 26/09/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
> And their functions are at different locations.
> >>> id(cElementTree.ElementTree._write)
> >>> id(elementtree.ElementTree.ElementTree._write)
Note that the above test doesn't actually prove anything:
>>> write1 = cElementTree.ElementTree._write
>>> write2 = cElementTree.ElementTree._write
>>> id(write1) == id(write2)
This is because the expression "cElementTree.ElementTree._write"
returns an unbound method object, which is created on request.
In fact, your original test could easily give the same result for both
the cElementTree and ElementTree unbound methods. The lesson here
being that id() only uniquely identifies an object for the life of
that object -- you can have two objects with the same id() provided
they don't exist at the same time.
You were correct about the two ElementTree classes being different thoug ...
More information about the bazaar