Re: [Python-Dev] A bit about the GIL

2013-03-31 Thread Nick Coghlan
On Mon, Apr 1, 2013 at 11:49 AM, R. David Murray wrote: > On Mon, 01 Apr 2013 01:14:11 +0200, > =?UTF-8?Q?Alfredo_Solano_Mart=C3=ADnez?= wrote: > > Simply put, make the reference counter a sharded one. That is, separate > it > > into several subcounters, in this case one for each thread. > > It s

Re: [Python-Dev] A bit about the GIL

2013-03-31 Thread R. David Murray
On Mon, 01 Apr 2013 01:14:11 +0200, =?UTF-8?Q?Alfredo_Solano_Mart=C3=ADnez?= wrote: > Simply put, make the reference counter a sharded one. That is, separate it > into several subcounters, in this case one for each thread. It seems to me this has a family resemblance to some of the stuff Trent i

[Python-Dev] A bit about the GIL

2013-03-31 Thread Alfredo Solano Martínez
Hi, I know this may be tiresome by now, so feel free to ignore, but I'd like to share with the list an idea about the GIL, more specifically the reference counting mechanism. Simply put, make the reference counter a sharded one. That is, separate it into several subcounters, in this case one for

Re: [Python-Dev] mingw32 port

2013-03-31 Thread Roumen Petrov
Matthias Klose wrote: [No, I'm not interested in the port myself] patches for a mingw32 port are floating around on the web and the python bug tracker, although most of them as a set of patches in one issue addressing several things, and which maybe outdated for the trunk. at least for me re-rea

Re: [Python-Dev] [Python-checkins] cpython (2.7): Add an itertools recipe showing how to use t.__copy__().

2013-03-31 Thread Brett Cannon
"Upcomping" -> "upcoming" On Mar 31, 2013 2:38 AM, "raymond.hettinger" wrote: > http://hg.python.org/cpython/rev/1026b1d47f30 > changeset: 83037:1026b1d47f30 > branch: 2.7 > parent: 83034:e044d22d2f61 > user:Raymond Hettinger > date:Sat Mar 30 23:37:57 2013 -0700 > su

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-03-31 Thread francis
and two instances i1 = Int1() i2 = Int2() we get the following behaviour: >>> type(int(i1)) I would have expected 'Int1' >>> type(float(i1)) >>> type(float(i2)) >>> isinstance(int(i1), int) True >>> isinstance(int(i2), int) new True >>> isinstance(float(i1), float) True >>> isinstanc

Re: [Python-Dev] py2.7: dictobject not properly resizing

2013-03-31 Thread Micha Gorelick
So I did a bit of benchmarking and attached is the code I used. With downsizing happening when ma_used * 2 <= ma_filled, or the following for the condition in question: if (mp->ma_used <= n_used || (mp->ma_fill*3 < (mp->ma_mask+1)*2 && mp->ma_used*2 > mp->ma_fill)) I see marginally faster pe

Re: [Python-Dev] Idle, site.py, and the release candidates

2013-03-31 Thread Antoine Pitrou
On Sun, 31 Mar 2013 11:38:07 -0400 Terry Jan Reedy wrote: > On 3/31/2013 6:01 AM, Antoine Pitrou wrote: > > > That said, if IDLE users expect those global functions, perhaps IDLE > > should define its own ones rather than rely on site.py. > > I thought of that. Idle would have to check the begi

Re: [Python-Dev] Idle, site.py, and the release candidates

2013-03-31 Thread Terry Jan Reedy
On 3/31/2013 6:01 AM, Antoine Pitrou wrote: That said, if IDLE users expect those global functions, perhaps IDLE should define its own ones rather than rely on site.py. I thought of that. Idle would have to check the beginning of every statement before sending it to the user process, which wo

Re: [Python-Dev] Idle, site.py, and the release candidates

2013-03-31 Thread Terry Jan Reedy
On 3/31/2013 3:52 AM, Terry Reedy wrote: For an rc patch, the safest temporary patch would be to start .__call__ with if sys.stdin.__name__ == 'PseudoInputFile': sys.stdin.close() I would have to check that the name is correct as seen in the user process (cannot at moment). In addition, idlel

Re: [Python-Dev] Semantics of __int__(), __index__()

2013-03-31 Thread Mark Dickinson
On Sun, Mar 31, 2013 at 2:29 PM, Mark Shannon wrote: > class Int1(int): > def __init__(self, val=0): > print("new %s" % self.__class__) > > class Int2(Int1): > def __int__(self): > return self > > and two instances > i1 = Int1() > i2 = Int2() > > we get the following behav

[Python-Dev] Semantics of __int__(), __index__()

2013-03-31 Thread Mark Shannon
Hi all, I was looking into http://bugs.python.org/issue17576 and I found that the semantics of __int__() and __index__() are not precisely defined in the documentation and that the implementation (CPython 3.4a) has some odd behaviour. Defining two classes: class Int1(int): def __init__(

Re: [Python-Dev] Idle, site.py, and the release candidates

2013-03-31 Thread Antoine Pitrou
On Sat, 30 Mar 2013 22:34:32 -0400 Terry Jan Reedy wrote: > > I do not know enough about other circumstances in which stdin.fileno > would do something other than return 0 to be sure of what the proper fix > would be. > (I increasingly dislike bare excepts as they hide the > thinking and knowl

Re: [Python-Dev] Idle, site.py, and the release candidates

2013-03-31 Thread Terry Reedy
On 3/31/2013 2:39 AM, Nick Coghlan wrote: On Sun, Mar 31, 2013 at 12:34 PM, Terry Jan Reedy > I do not know enough about other circumstances in which stdin.fileno would do something other than return 0 to be sure of what the proper fix would be. (I increasin