First shot at some_set.get()
Hi, here is the first shot to provide a faster means of retrieving an arbitrary element from a set without removing it. The times for ========================= from timeit import * stat1 = "for i in xrange(100): iter(s).next()" stat2 = "for i in xrange(100): s.get()" for stat in [stat1, stat2]: t = Timer(stat, setup="s=set(range(10000))") # outside the try/except try: print t.timeit(number=1000) except: t.print_exc() ========================= are stat1: 0.0451760292053 stat2: 0.0148510932922 The patch is attached. Feel free to criticize. I would love to see something like that in the standard Python interpreter. Regards, wr
On Fri, Oct 23, 2009 at 12:23:08PM +0200, Willi Richert wrote:
The patch is attached.
Patches should be put to the issue tracker. Thank you. Oleg. -- Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Fri, 23 Oct 2009 09:37:09 pm Oleg Broytman wrote:
On Fri, Oct 23, 2009 at 12:23:08PM +0200, Willi Richert wrote:
The patch is attached.
Patches should be put to the issue tracker. Thank you.
Is there any point? Even if accepted, it's too late to make it into 3.1, and with the overwhelming approval for a moratorium on changes to built-ins, it is likely to just sit in the tracker, forgotten, until 2013 or later. How likely is it that the patch will still be applicable? -- Steven D'Aprano
On Fri, Oct 23, 2009 at 1:09 PM, Steven D'Aprano <steve@pearwood.info> wrote:
Is there any point? Even if accepted, it's too late to make it into 3.1, and with the overwhelming approval for a moratorium on changes to built-ins, it is likely to just sit in the tracker, forgotten, until 2013 or later. How likely is it that the patch will still be applicable?
+1 on throwing it away completely even if it's a good idea. I suggest Willi go invent a new language (and hope for it to become popular :-) if he wants to experiment. --yuv
Yuvgoog Greenle wrote:
On Fri, Oct 23, 2009 at 1:09 PM, Steven D'Aprano <steve@pearwood.info> wrote:
Is there any point? Even if accepted, it's too late to make it into 3.1, and with the overwhelming approval for a moratorium on changes to built-ins, it is likely to just sit in the tracker, forgotten, until 2013 or later. How likely is it that the patch will still be applicable?
+1 on throwing it away completely even if it's a good idea. I suggest Willi go invent a new language (and hope for it to become popular :-) if he wants to experiment.
Careful folks - these kinds of throwaway comments may be clearly tongue in cheek for anyone following the moratorium discussion on python-ideas, but will be justifiably confusing to anyone else, especially newcomers. Willi - Oleg is right that patches should go on the issue tracker. They tend to get lost if they only exist on the mailing list. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------
On Fri, 23 Oct 2009 11:47:22 pm Nick Coghlan wrote:
Yuvgoog Greenle wrote:
On Fri, Oct 23, 2009 at 1:09 PM, Steven D'Aprano <steve@pearwood.info> wrote:
Is there any point? Even if accepted, it's too late to make it into 3.1, and with the overwhelming approval for a moratorium on changes to built-ins, it is likely to just sit in the tracker, forgotten, until 2013 or later. How likely is it that the patch will still be applicable?
+1 on throwing it away completely even if it's a good idea. I suggest Willi go invent a new language (and hope for it to become popular :-) if he wants to experiment.
Careful folks - these kinds of throwaway comments may be clearly tongue in cheek for anyone following the moratorium discussion on python-ideas, but will be justifiably confusing to anyone else, especially newcomers.
I'm not being tongue-in-cheek or sarcastic. My question was serious -- if there is a moratorium, is there any reason to bother submitting patches for functional changes to built-ins? A lot can change between now and 2013, and I for one wouldn't bother making a patch that I knew wouldn't even be considered for inclusion for four years, and would likely need to be re-done even if it was accepted. Guido has said that the purpose of the moratorium is to discourage changes to the language. If we're discouraging changes, shouldn't we actually discourage them rather than waste people's time and give them false hope by telling them to put them in the tracker? Nick, you made the comparison with C in another thread. I don't think that the comparison with C is apt, for various reasons, but putting that aside, given that C is so stable, what do they do with suggested changes to the language? Is there a C issue tracker with ten years of accumulated patches, or even proposals, in the queue? -- Steven D'Aprano
Steven D'Aprano writes:
I'm not being tongue-in-cheek or sarcastic. My question was serious -- if there is a moratorium, is there any reason to bother submitting patches for functional changes to built-ins?
Yes. Python is open source. Private and public forks are possible and (at least in principle) encouraged where the core project decides that the proposed changes are inappropriate (or should be deferred, as here). Nevertheless, isn't the core Python project the obvious common point of contact for sharing such ideas, even if there is a moratorium on the code base itself? I know that a few patches to Mailman have lived for nearly a decade, beloved by their users and not (much) bothering the Mailman maintainers with their obvious pitfalls for naive users. Whether the tracker is the appropriate place is another question, but I think it's easier to search for "serious proposal with patch" than the mailing lists.
On Sat, 24 Oct 2009 05:04:33 pm Stephen J. Turnbull wrote:
Steven D'Aprano writes:
> I'm not being tongue-in-cheek or sarcastic. My question was serious -- > if there is a moratorium, is there any reason to bother submitting > patches for functional changes to built-ins?
Yes. Python is open source. Private and public forks are possible and (at least in principle) encouraged where the core project decides that the proposed changes are inappropriate (or should be deferred, as here). Nevertheless, isn't the core Python project the obvious common point of contact for sharing such ideas, even if there is a moratorium on the code base itself?
No. It's not obvious to me that the CPython tracker is the right place for patches for implementations that aren't for CPython. It's not even obvious that there would be a common point of contact for private and public forks, let alone that it would be CPython's tracker. There are, by my count, 14 active and defunct implementations of Python to date, apart from CPython itself. How many of them currently use the CPython tracker to share patches? If the answer is "None", why would you expect future implementations and forks to be any different? -- Steven D'Aprano
I'm not being tongue-in-cheek or sarcastic. My question was serious -- if there is a moratorium, is there any reason to bother submitting patches for functional changes to built-ins? A lot can change between now and 2013, and I for one wouldn't bother making a patch that I knew wouldn't even be considered for inclusion for four years, and would likely need to be re-done even if it was accepted. Guido has said that the purpose of the moratorium is to discourage changes to the language.
I haven't been following the discussion, but I wouldn't expect that a moratorium on language changes would rule out adding a method to the set type. Regards, Martin
On Sat, Oct 24, 2009 at 11:28 AM, "Martin v. Löwis" <martin@v.loewis.de> wrote:
I'm not being tongue-in-cheek or sarcastic. My question was serious -- if there is a moratorium, is there any reason to bother submitting patches for functional changes to built-ins? A lot can change between now and 2013, and I for one wouldn't bother making a patch that I knew wouldn't even be considered for inclusion for four years, and would likely need to be re-done even if it was accepted. Guido has said that the purpose of the moratorium is to discourage changes to the language.
I haven't been following the discussion, but I wouldn't expect that a moratorium on language changes would rule out adding a method to the set type.
Regards, Martin
My understanding is that the moratorium would preclude changes to the builtins. Is that not the case here? Geremy Condra
On Sat, Oct 24, 2009 at 10:55 AM, geremy condra <debatem1@gmail.com> wrote:
My understanding is that the moratorium would preclude changes to the builtins. Is that not the case here?
It is as yet undecided. -- --Guido van Rossum PS. My elbow needs a couple more weeks of rest. Limiting myself to ultra-short emails.
participants (9)
-
"Martin v. Löwis"
-
geremy condra
-
Guido van Rossum
-
Nick Coghlan
-
Oleg Broytman
-
Stephen J. Turnbull
-
Steven D'Aprano
-
Willi Richert
-
Yuvgoog Greenle