[issue5964] WeakSet cmp methods

2009-05-17 Thread Robert Schuppenies
Robert Schuppenies robert.schuppen...@gmail.com added the comment: Fixed in r72751. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964 ___

[issue5964] WeakSet cmp methods

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Why are you confused? You already asked that question earlier in the thread. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964 ___

[issue5964] WeakSet cmp methods

2009-05-15 Thread Robert Schuppenies
Robert Schuppenies robert.schuppen...@gmail.com added the comment: Maybe because I take the doc too specfic. It says A rich comparison method may return the singleton NotImplemented if it does not implement the operation for a given pair of arguments. I see the type check of the 'other' object

[issue5964] WeakSet cmp methods

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I see the type check of the 'other' object as an operation towards the equal comparison, since it validates wether 'self' and 'other' can be equal at all. If they are of a different type, then they cannot be equal, thus the anwser to Are

[issue5964] WeakSet cmp methods

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: You can commit the latest patch, provided all tests pass. -- assignee: - schuppenies resolution: - accepted stage: patch review - commit review ___ Python tracker rep...@bugs.python.org

[issue5964] WeakSet cmp methods

2009-05-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Is the current patch ready for consumption? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964 ___

[issue5964] WeakSet cmp methods

2009-05-14 Thread Robert Schuppenies
Robert Schuppenies robert.schuppen...@gmail.com added the comment: The test passes on my machine, but a quick review would definitely be nice :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964

[issue5964] WeakSet cmp methods

2009-05-14 Thread Robert Schuppenies
Robert Schuppenies robert.schuppen...@gmail.com added the comment: If that is the right behavior then yes. Is this documented somewhere? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964

[issue5964] WeakSet cmp methods

2009-05-14 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: See http://docs.python.org/reference/datamodel.html#object.__eq__ -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964

[issue5964] WeakSet cmp methods

2009-05-12 Thread Robert Schuppenies
Changes by Robert Schuppenies robert.schuppen...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964 ___

[issue5964] WeakSet cmp methods

2009-05-11 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: 2. The current WeakSet implementation returns True if a WeakSet is compared to any Iterable which contains the same set of objects: Sounds bad. It should probably be fixed. -- ___ Python tracker

[issue5964] WeakSet cmp methods

2009-05-11 Thread Robert Schuppenies
Robert Schuppenies robert.schuppen...@gmail.com added the comment: Sounds right to me. Here is another patch plus tests. Going through the other tests, I adapted two more tests to actually test WeakSet. Also, I found the following one and think it is a copypaste from test_set which is not

[issue5964] WeakSet cmp methods

2009-05-11 Thread Robert Schuppenies
Changes by Robert Schuppenies robert.schuppen...@gmail.com: Removed file: http://bugs.python.org/file13955/_weakrefset.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5964 ___

[issue5964] WeakSet cmp methods

2009-05-11 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Going through the other tests, I adapted two more tests to actually test WeakSet. Also, I found the following one and think it is a copypaste from test_set which is not useful for test_weakset. Should it be removed (as currently done in the

[issue5964] WeakSet cmp methods

2009-05-10 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I don't think it is the intended behaviour. Comparison for equality should return either True or False (or perhaps NotImplemented?), not raise a TypeError. -- nosy: +pitrou priority: - normal stage: - needs patch

[issue5964] WeakSet cmp methods

2009-05-10 Thread Robert Schuppenies
Robert Schuppenies robert.schuppen...@gmail.com added the comment: Here is a patch which will return False instead of TypeError. This is the same behavior a normal set has. Two things though. 1. I don't know wether the 'import _abcoll' statement somehow influences the bootstrap in one way or

[issue5964] WeakSet cmp methods

2009-05-07 Thread Robert Schuppenies
New submission from Robert Schuppenies robert.schuppen...@gmail.com: Running this code: import weakref class C: pass ... ws = weakref.WeakSet([C]) if ws == 1: ... print(1) ... gives me the following exception: Traceback (most recent call last): File stdin, line 1, in module