[issue14320] set.add can return boolean indicate newly added item

2012-03-16 Thread Matt Joiner
Matt Joiner anacro...@gmail.com added the comment: Is there still some value to at least exposing this in the C API, per the precedents I mentioned? The patch also contains some adjustment to the set_add_entry/set_add_key abstraction dance, and some future proofing of PySet_Add return values

[issue14320] set.add can return boolean indicate newly added item

2012-03-16 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14320 ___ ___

[issue14320] set.add can return boolean indicate newly added item

2012-03-15 Thread Matt Joiner
New submission from Matt Joiner anacro...@gmail.com: set.add can return True to indicate a newly added item to the set, or False if the item was already present. The C function PySet_Add returns -1 on error, and 0 on success currently. This is extended to return 1 if the item is newly added,

[issue14320] set.add can return boolean indicate newly added item

2012-03-15 Thread Matt Joiner
Changes by Matt Joiner anacro...@gmail.com: Added file: http://bugs.python.org/file24863/bench_set_add.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14320 ___

[issue14320] set.add can return boolean indicate newly added item

2012-03-15 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14320 ___

[issue14320] set.add can return boolean indicate newly added item

2012-03-15 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: The part of the patch for PySet_Add() is a reasonable improvement to the C API if it doesn't conflict with Martin's stable ABI effort. The question of whether to change the Python API requires much more thought and I'll do some

[issue14320] set.add can return boolean indicate newly added item

2012-03-15 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: Here's the results of the research so far: Guido gave it a -1: http://mail.python.org/pipermail/python-ideas/2012-March/014510.html Smalltalk does not return a boolean: