Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46178

Re: Solving the problem of mutual recursion

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.045
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'cpython': 0.05; 'binary': 0.07; 'works.': 0.09; 'did.': 0.16; 'finer': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'heap,': 0.16; 'simplified': 0.16; 'subject:recursion': 0.16; 'variables,': 0.16; 'prevent': 0.16; 'language': 0.16; 'wrote:': 0.18; 'figures': 0.19; 'saying': 0.22; 'separate': 0.22; 'subject:problem': 0.24; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'message-id:@mail.gmail.com': 0.30; 'went': 0.31; 'operations.': 0.31; "they'll": 0.31; 'though.': 0.31; 'run': 0.32; 'running': 0.33; 'sense': 0.34; 'subject:the': 0.34; 'problem': 0.35; "can't": 0.35; 'received:209.85': 0.35; 'except': 0.35; 'received:209.85.220': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'should': 0.36; 'example,': 0.37; 'two': 0.37; 'received:209': 0.37; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'ian': 0.60; 'new': 0.61; "you're": 0.61; 'complete': 0.62; 'different': 0.65; '26,': 0.68; 'analysis': 0.75; 'potentially': 0.81; 'atomic': 0.84; 'choices.': 0.84; 'thing,': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=8DppWbkzjzI7zfAPhVBnL5UiytYNpAinriisyIoW55g=; b=ZkRwZ91hOa+SxKJEUQPteDfhbL84oh7/g6gFyzcIY+G+DKl0ghBIPxaFW1v+W3mfjI MQZS16ZRNSl6mbRgLTepr5UHt+xh35NIFzHrlyhZyQQWuwQtvMzqDm9UbwmJasa3N+eY 9cGl7Ix0vEPk3GgEsmyxcWR1WCS6RTb1RomjEGcuKrWg6CuMFnjw9cwpXc+SfQ6s6BDn +01JQ2SBPGu+UkMMdm724HvRM0mXV8TFqRXtESPnVKX8OqHjOyIea3TqZfoPozedD9Q2 dcBXMHo6OnSEMWKBQwd0wG4P56RKc+XGjith2l7TAycQEucQAKNm22Ij6j3RlVOyNMj4 Yxbw==
MIME-Version 1.0
X-Received by 10.220.215.73 with SMTP id hd9mr7537489vcb.19.1369640241244; Mon, 27 May 2013 00:37:21 -0700 (PDT)
In-Reply-To <CALwzidnz1Fnrg1W3AtF+WLk7hX88N=4A4_NK4dKV1UfWZhYMig@mail.gmail.com>
References <55942e65-e4a5-45fc-b2fc-ceb4020959dd@k4g2000vba.googlegroups.com> <qota9nhu6ag.fsf@ruuvi.it.helsinki.fi> <d54dff54-73cc-4b90-8a85-bafd5118489f@cl9g2000vbb.googlegroups.com> <mailman.2185.1369591777.3114.python-list@python.org> <074eac8a-1bc4-4fe0-afa9-1f52405f81d5@k3g2000vbn.googlegroups.com> <CALwzidkUtWZvVvdKhU7usYw2e926z4XT_hvHTKOQbDGmmLMCQg@mail.gmail.com> <mailman.2209.1369606596.3114.python-list@python.org> <9890fd93-fd9b-4865-a01e-4cd1d558d5fc@w15g2000vbn.googlegroups.com> <CALwzidnz1Fnrg1W3AtF+WLk7hX88N=4A4_NK4dKV1UfWZhYMig@mail.gmail.com>
Date Mon, 27 May 2013 17:37:21 +1000
Subject Re: Solving the problem of mutual recursion
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2239.1369640244.3114.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369640244 news.xs4all.nl 15959 [2001:888:2000:d::a6]:54044
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46178

Show key headers only | View raw


On Mon, May 27, 2013 at 4:07 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Sun, May 26, 2013 at 10:36 PM, Peter Brooks
> <peter.h.m.brooks@gmail.com> wrote:
>> This makes complete sense - any atomic action should be atomic, so two
>> threads can't be doing it at the same time. They can be doing anything
>> else though.
>>
>> If two threads create a new object at the same time, for example,
>> there's potentially the problem that they'll get the same space, so
>> the object will be owned by both. To prevent this, the new object call
>> should be run in only one thread.
>>
>> If you have two objects running their methods on their own local
>> variables, then there's no potential for conflict, so there's no need
>> for them to be blocked.
>
> That's not the way it works. [snip details]

You're actually both saying the same thing, except that Peter went for
finer granularity than Ian and CPython did. CPython figures that, with
a refcounted heap, there's not a lot of point having separate mutex
locks for different operations. Other language interpreters have made
other choices. But Peter's analysis is still correct; it's just that
guarding it is simplified down to a binary state: either you have the
GIL, or you don't.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Solving the problem of mutual recursion Peter Brooks <peter.h.m.brooks@gmail.com> - 2013-05-26 04:49 -0700
  Re: Solving the problem of mutual recursion Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-05-26 18:09 +0300
    Re: Solving the problem of mutual recursion Roy Smith <roy@panix.com> - 2013-05-26 11:23 -0400
    Re: Solving the problem of mutual recursion Peter Brooks <peter.h.m.brooks@gmail.com> - 2013-05-26 10:21 -0700
      RE: Solving the problem of mutual recursion Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-26 21:09 +0300
        Re: Solving the problem of mutual recursion Peter Brooks <peter.h.m.brooks@gmail.com> - 2013-05-26 11:13 -0700
          RE: Solving the problem of mutual recursion Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-26 21:22 +0300
            Re: Solving the problem of mutual recursion Peter Brooks <peter.h.m.brooks@gmail.com> - 2013-05-26 12:05 -0700
          Re: Solving the problem of mutual recursion Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-26 13:35 -0600
          Re: Solving the problem of mutual recursion Chris Angelico <rosuav@gmail.com> - 2013-05-27 08:16 +1000
            Re: Solving the problem of mutual recursion Peter Brooks <peter.h.m.brooks@gmail.com> - 2013-05-26 21:36 -0700
              Re: Solving the problem of mutual recursion Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-27 00:07 -0600
              Re: Solving the problem of mutual recursion Chris Angelico <rosuav@gmail.com> - 2013-05-27 17:37 +1000
          Re: Solving the problem of mutual recursion Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-27 00:19 -0600
          Re: Solving the problem of mutual recursion Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-27 01:04 -0600

csiph-web