[issue7224] One obvious way to do interning

2009-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thank you. -- resolution: -> rejected status: open -> closed ___ Python tracker ___ ___ Python-b

[issue7224] One obvious way to do interning

2009-11-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Thu, Nov 5, 2009 at 3:23 PM, Raymond Hettinger wrote: .. > Martin has already rejected a similar proposal for similar reasons. > Please drop this one. Sure. In fact I've never proposed to apply this patch. As I said in my original submission, the on

[issue7224] One obvious way to do interning

2009-11-05 Thread Eric Smith
Eric Smith added the comment: I agree with Raymond here. This use case isn't special enough, or the performance of the current "one way to do it" bad enough to warrant changing set. I recommend closing this issue. -- nosy: +eric.smith ___ Python trac

[issue7224] One obvious way to do interning

2009-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: That is a false optimization. Regular python code is full of look-ups (even set.add has a getattr(s, 'add') lookup just to find the add-method; every call to a built-in typically goes through multiple lookups). Also, the cost of a second lookup is trivial

[issue7224] One obvious way to do interning

2009-11-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Thu, Nov 5, 2009 at 2:16 PM, Raymond Hettinger wrote: > > Raymond Hettinger added the comment: > > The basic problem here is that the "one obvious way" to some people > (including me and Martin v. Löwis) is to use a dictionary.  Further, > there is th

[issue7224] One obvious way to do interning

2009-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: The basic problem here is that the "one obvious way" to some people (including me and Martin v. Löwis) is to use a dictionary. Further, there is the problem of conflating types in a user's mind -- right now, dictionaries are all about looking up and returnin

[issue7224] One obvious way to do interning

2009-11-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Wed, Nov 4, 2009 at 9:46 AM, Nick Coghlan wrote: > > Nick Coghlan added the comment: > > If the idea is to create the "one obvious way" for interning, calling > the method and corresponding C function "intern" isn't painting a > bikeshed, it's meeting

[issue7224] One obvious way to do interning

2009-11-04 Thread Nick Coghlan
Nick Coghlan added the comment: If the idea is to create the "one obvious way" for interning, calling the method and corresponding C function "intern" isn't painting a bikeshed, it's meeting the design spec :) Adding a new method also avoids a whole host of issues with the Set ABC. --

[issue7224] One obvious way to do interning

2009-10-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I agree, _PySet_Add name can be improved upon, but I don't want to paint this particular bikeshed until it is clearer what if anything will be done with this idea. If we add PySet_Intern API, then it would be natural to expose it as set.intern rather t

[issue7224] One obvious way to do interning

2009-10-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: A simple way to try and see a difference would be to import lot of modules. By the way, you shouldn't call it _PySet_Add(), it would cause confusion with the existing PySet_Add(). _PySet_Intern() would be fine. -- nosy: +pitrou ___

[issue7224] One obvious way to do interning

2009-10-27 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger versions: +Python 2.7, Python 3.2 ___ Python tracker ___ _

[issue7224] One obvious way to do interning

2009-10-27 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : Attached patch implements python-ideas proposal to return added or existing element from set.add(). See http://mail.python.org/pipermail/python-ideas/2009-October/006491.html . In addition this patch contains a reimplementation of issue1507011 using