Re: patch request for os.urandom()

2014-07-17 Thread Christian Heimes
On 17.07.2014 20:34, Paul Rubin wrote: > Could os.urandom() be patched to use the new Linux getrandom() system > call on systems where it is available? Further info: > > http://lists.openwall.net/linux-kernel/2014/07/17/235 > > I've stopped posting to the Python bug tracker because the password

Re: patch request for os.urandom()

2014-07-17 Thread Sturla Molden
On 17/07/14 20:34, Paul Rubin wrote: Could os.urandom() be patched to use the new Linux getrandom() system call on systems where it is available? /dev/urandom exists on other Unix-like systems as well. Right now os.urandom only uses special system calls on Windows. Sturla -- https://mail.

Re: patch request for os.urandom()

2014-07-17 Thread Ned Deily
In article <[email protected]>, Paul Rubin wrote: > I've stopped posting to the Python bug tracker because the password > management issues became too annoying. Can you elaborate on the problems you are having? -- Ned Deily, [email protected] -- https://mail.python.org/mailman/

Re: patch request for os.urandom()

2014-07-17 Thread Chris Angelico
On Fri, Jul 18, 2014 at 4:34 AM, Paul Rubin wrote: > Could os.urandom() be patched to use the new Linux getrandom() system > call on systems where it is available? Further info: > > http://lists.openwall.net/linux-kernel/2014/07/17/235 Uhm... does that even exist in kernel trunk yet? That's pret

Re: Patch for IDLE/OS X to work with Tk-Cocoa

2010-01-22 Thread Kevin Walzer
On 1/22/10 5:47 PM, G73 wrote: im trying to update a patch. here is link to various patches http://bugs.python.org/issue6075 how do i update the patch, say for EditorWindow.patch. i have located my python installation the EditorWindow.py, and i can see some differences (which lines from the patc

Re: patch

2009-01-06 Thread geon
sorry, pls forget :-( -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-05 Thread Larry Hastings
Nicko wrote: > I note that in both of those tests you didn't actually ever realise the > concatenated string. Can you give us figures for these tests having > forced the concatenated string to be computed? Sure, good call. And bad news. All these benchmarks were with functions taking N argument

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-04 Thread Nicko
Larry Hastings wrote: > It's *slightly* slower for two: > > def addTwoThings(a, b): > return a + b > for i in range(1000): > x = addTwoThings("aaa", "bbb") ... > But starts paying off already, even with three: > > def addThreeThings(a, b, c): > return a + b + c > for i in range(1000

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Terry Reedy
"> Forgot to mention this, in case you haven't done so post your original > message/patch on the python-dev lists since that's where the decisions > are made. This group is more end-user oriented. > > http://mail.python.org/pipermail/python-dev/2006-October/thread.html It is often good to get com

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Istvan Albert
Larry Hastings wrote: > That patch addressed the same general problem, but took a completely > different approach. For the record, this patch (#980695) optimized "x Larry, Forgot to mention this, in case you haven't done so post your original message/patch on the python-dev lists since that's w

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Larry Hastings
Istvan Albert wrote: > I remember a similar patch from some time ago: > > http://mail.python.org/pipermail/python-dev/2004-August/046686.html That patch addressed the same general problem, but took a completely different approach. For the record, this patch (#980695) optimized "x += a" by examini

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Istvan Albert
I remember a similar patch from some time ago: http://mail.python.org/pipermail/python-dev/2004-August/046686.html i -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Larry Hastings
John Machin wrote: > Don't you mean y = x[1] or something like that? y = "".join(x) looks > like a copy-paste error. You're right, by gum. Worse than that, my benchmark wasn't actually *doing* much of anything there; at the end of the run x was still length 0. That was sloppy, and I apologize.

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-02 Thread John Machin
Larry Hastings wrote: > > John Machin wrote: > > try benchmarking this ... well "style" may not be the appropriate word > > Running this under Python 2.5 release: > x = [] > xappend = x.append > for i in xrange(1000): > xappend("a") > y = "".join(x) > took 3281ms. > >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-02 Thread Larry Hastings
Fredrik Lundh wrote: > You should also benchmark this against code that uses the ordinary > append/join pattern. Sorry, thought I had. Of course, now that the patch is up on Sourceforce you could download it and run all the benchmarks you like. For all the benchmarks I ran below, the number list

PyCon proposals (was Re: PATCH: Speed up direct string concatenation by 20+%!)

2006-10-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Larry Hastings <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> >> I think your project might make a very >> interesting PyCon paper for people who were thinking about joining the >> development effort but hadn't yet started. > >Perhaps; I've never been to PyCon, b

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-02 Thread John Machin
Fredrik Lundh wrote: > > You should also benchmark this against code that uses the ordinary > append/join pattern. (you've posted conflicting benchmarks for 2.5, > but if I'm trusting the benchmarks that looks more reasonable, the > standard implementation pattern is still around 10 times faster

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-01 Thread Fredrik Lundh
Larry Hastings wrote: > There are some improvements in this version. Specifically: > > * Python will no longer crash if you do ten million prepends > ( x = 'a' + x ). Since the problem was blowing the stack > with an incredibly deep render, I now limit the depth of > the string concatenat

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-01 Thread Larry Hastings
An update: I have submitted this as a patch on SourceForge. It's request ID #1569040. http://sourceforge.net/tracker/?group_id=5470&atid=305470 I invite everyone to take it for a spin! There are some improvements in this version. Specifically: * Python will no longer crash if you do ten

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-01 Thread Colin J. Williams
Congratulations on the clear way in which you have set out your proposal. I hope that it will make its way to PEPdom. Colin W. Larry Hastings wrote: > This is such a long posting that I've broken it out into sections. > Note that while developing this patch I discovered a Subtle Bug > in CPython

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-30 Thread Steve Holden
Larry Hastings wrote: > Fredrik Lundh wrote: > >>so what does the benchmark look like if you actually do this ? > > > Okay, timing this: > x = "" > for i in range(10): > x += "a" > t = x[1] # forces the concat object to render > > The result: > Python 2.5 release: 30.0s > Pyth

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Larry Hastings wrote: [snip] > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds references to the two strings but does not actually > concatenate > them... yet. The strings are concatenated

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
Fredrik Lundh wrote: > so what does the benchmark look like if you actually do this ? Okay, timing this: x = "" for i in range(10): x += "a" t = x[1] # forces the concat object to render The result: Python 2.5 release: 30.0s Python 2.5 locally built: 30.2s Python 2.5 concat: 4

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Fredrik Lundh
Larry Hastings wrote: > > At the exact moment that the loop is done, it's a > PyStringConcatenationObject * which points to a deep one-sided tree of > more PyStringConcatenationObject * objects. Its ob_sval is NULL, which > means that the first time someone asks for its value (via the macro > PyS

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
Fredrik Lundh wrote: > >> what's in "s" when that loop is done? > > It's equivalent to " 'a' * 1000 ". (I shan't post it here.) > but what *is* it ? an ordinary PyString object with a flattened buffer, > or something else ? At the exact moment that the loop is done, it's a PyStringConcatenat

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
William Heymann wrote: > This is a pretty small change but I would suggest xrange instead of range. Good point! Since I was calling range() during the benchmark, it was timed too. Switching to xrange() will mean less overhead. I re-ran this benchmark (again): s = "" for i in range(10):

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Fredrik Lundh
Larry Hastings wrote: >> what's in "s" when that loop is done? > > It's equivalent to " 'a' * 1000 ". (I shan't post it here.) but what *is* it ? an ordinary PyString object with a flattened buffer, or something else ? -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread William Heymann
On Friday 29 September 2006 08:34, Larry Hastings wrote: > It would still blow up if you ran > s = "" > for i in range(1000): > s = "a" + s This is a pretty small change but I would suggest xrange instead of range. That way you don't allocate that large list just to throw all the ite

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
Fredrik Lundh wrote: > > Sure. Here are the results, but with range (1000): > ten million? what hardware are you running this on? Athlon 64 x2 4400+ (aka 2.2GHz), 3GB of RAM, Windows XP. > what's in "s" when that loop is done? It's equivalent to " 'a' * 1000 ". (I shan't post it here

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Fredrik Lundh
Larry Hastings wrote: >> Nice idea, though. You might also see how it does on tasks like >> >> s = "" >> for i in range(10): >> s += "a" > > Sure. Here are the results, but with range (1000): ten million? what hardware are you running this on? > Python 2.5 release: 31.0s >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
Steve Holden wrote: > you should diff your source against the current > SVN repository and lodge that diff as a patch on SourceForge. Okay, I'll try to do that today. > Your suggested bug isn't, I think a real bug in the current > implementation because as I understand it Python strings do alwa

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Carl Friedrich Bolz wrote: > Robin Becker wrote: >> Larry Hastings wrote: >> __ >>> THE PATCH >>> >>> The core concept: adding two strings together no longer returns a pure >>> "string" object. Instead, it returns a "string concatenation" object >>> which holds references to the two strings bu

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread cfbolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Carl Friedrich Bolz
Robin Becker wrote: > Larry Hastings wrote: > __ >> THE PATCH >> >> The core concept: adding two strings together no longer returns a pure >> "string" object. Instead, it returns a "string concatenation" object >> which holds references to the two strings but does not actually >> concatenate >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Felipe Almeida Lessa
28 Sep 2006 19:07:23 -0700, Larry Hastings <[EMAIL PROTECTED]>: > THE BENCHMARKS > > Benchmark 1: > def add(a, b, c, ... t): return a + b + c + ... + t > for i in range(1000): add("aaa", "bbb", "ccc", ..., "ttt") [snip] What about "a + b"? Or "a + b + c"? Does it have a large o

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Rob Williscroft
Larry Hastings wrote in news:1159495643.213830.289620 @m7g2000cwm.googlegroups.com in comp.lang.python: > _ > THE PATCH > > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds referenc

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Robin Becker
Larry Hastings wrote: __ > THE PATCH > > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds references to the two strings but does not actually > concatenate > them... yet. The strings ar

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-28 Thread Steve Holden
Larry Hastings wrote: > This is such a long posting that I've broken it out into sections. > Note that while developing this patch I discovered a Subtle Bug > in CPython, which I have discussed in its own section below. > [...] > __ > THE SUBMISSION > > I don't know the protocol from

Re: Patch : doct.merge

2005-12-28 Thread Nicolas Lehuen
Here's method 3 : # Python 2.3 (no generator expression) a.update([(k,v) for k,v in b.iteritems() if k not in a]) # Python 2.4 (with generator expression) a.update((k,v) for k,v in b.iteritems() if k not in a) It's a bit cleaner but still less efficient than using what's already in the PyDict_Me

Re: [PATCH] add offset argument to mmap

2005-05-26 Thread Fredrik Lundh
Christopher Li wrote: > I am surprised to find out the mmap module in python always > mmap from offset 0. So I just hack up some patch to allow it > accept offset arguments. patches posted to the newsgroup are likely to be ignored or forgotten. patches posted to the patch tracker http://sou

Re: [PATCH] allow partial replace in string.Template

2005-02-15 Thread Nick Coghlan
Stefan Behnel wrote: Nick Coghlan wrote a) Patches are more likely to be looked at if placed on the SF patch tracker. see your own b), I wanted to discuss them first. Fair enough. Still, when I first tried out the Template class, I immediately stumbled over the fact that the substitute methods

Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Nick Craig-Wood
Nick Coghlan <[EMAIL PROTECTED]> wrote: > > a) Patches are more likely to be looked at if placed on the SF patch tracker. > > b) I don't quite see the point, given how easy these are to spell using the > basic safe_substitute. You're replacing one liners with one-liners. c) add a documentati

Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Stefan Behnel
Nick Coghlan wrote a) Patches are more likely to be looked at if placed on the SF patch tracker. see your own b), I wanted to discuss them first. b) I don't quite see the point, given how easy these are to spell using the basic safe_substitute. You're replacing one liners with one-liners. Still,

Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Nick Coghlan
a) Patches are more likely to be looked at if placed on the SF patch tracker. b) I don't quite see the point, given how easy these are to spell using the basic safe_substitute. You're replacing one liners with one-liners. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Aust

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-13 Thread Raymond Hettinger
"Stefan Behnel" > I generally believe that many programmers will > silently expect frozenset() to be (and become) more efficient than set() - in > whatever regard: processing, memory, etc. That belief is without foundation. Except for mutating methods and hashing methods, both set() and frozenset

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-13 Thread Stefan Behnel
Raymond Hettinger wrote: It is not quite correct to say that this is what all immutables do: .>>>x = 500 .>>>y = 600 - 100 .>>>x is y False That is an implementation detail, not guaranteed by the language (i.e. not necessarily true in future versions, in Jython, or other implementations). It is j

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-12 Thread Raymond Hettinger
> > It is not quite correct to say that this is what all immutables do: > > > >.>>>x = 500 > >.>>>y = 600 - 100 > >.>>>x is y > > False > > I know. The same is true for concateneted strings, etc. But whenever an > immutable object is created directly ('by hand'), it holds. It also holds, > btw, for

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-12 Thread Jp Calderone
On Sat, 12 Feb 2005 23:21:58 +0100, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > Raymond Hettinger wrote: > >Stefan Behnel wrote: > >>I stumbled over the fact that 'frozenset()' doesn't return a constant but > >>creates a new object everytime. Since it is immutable, I wrote to c.l.py > >>that

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-12 Thread Stefan Behnel
Raymond Hettinger wrote: >Stefan Behnel wrote: I stumbled over the fact that 'frozenset()' doesn't return a constant but creates a new object everytime. Since it is immutable, I wrote to c.l.py that this behaviour is different from what tuple() & Co do. It is not quite correct to say that this i