Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107455
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Detecting repeated subsequences of identical items |
| Date | Fri, 22 Apr 2016 01:02:27 +1000 |
| Lines | 38 |
| Message-ID | <mailman.16.1461250956.23626.python-list@python.org> (permalink) |
| References | <571843f9$0$1585$c3e8da3$5496439d@news.astraweb.com> <CAHVvXxTCQT0Tp3-Pd0O5mqSMDA6s=dqj+DDTpkq1AvYoCYs-7Q@mail.gmail.com> <mailman.7.1461228807.23626.python-list@python.org> <5718c457$0$1605$c3e8da3$5496439d@news.astraweb.com> <CAHVvXxQAPP8-31Nb3vM+=O4wYpXEuH1FH3n05N59KnqpC8C0PQ@mail.gmail.com> <CAPTjJmrp7ufKa194h4RrCh0F2y0FuDqaUkcV6-B-sHDWvosdKA@mail.gmail.com> <CAHVvXxQ=qbfxZAkznhFEpyNv-7WdFYzvJiQxrOzi9Ep7zanzaA@mail.gmail.com> <CAPTjJmpa8x3r_Y0Q-gZxHk-eLUH=wh=BpSJOwBGrE=OkgStmfg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de NZWi3QAI3bLOO579cdYT1Q+VMQRSSnGBBddHsPjSOYww== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'overflow': 0.07; 'see.': 0.07; 'cc:addr:python-list': 0.09; '22,': 0.09; 'benjamin': 0.09; 'exceptions,': 0.09; 'finite': 0.09; 'exception': 0.13; 'stack': 0.13; 'def': 0.13; '12:30': 0.16; '2016': 0.16; 'cc:name:python list': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hits': 0.16; 'problem).': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sequence.': 0.16; 'subject:Detecting': 0.16; 'wrote:': 0.16; 'have:': 0.18; '>>>': 0.20; '(not': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'bit': 0.23; 'forgot': 0.23; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'helpful': 0.27; 'point.': 0.27; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'sequence': 0.27; 'anywhere': 0.30; 'that.': 0.30; 'up.': 0.32; 'usually': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; "won't": 0.38; 'received:209': 0.38; 'end': 0.39; 'goes': 0.39; 'well.': 0.40; "you'll": 0.61; 'leading': 0.61; 'leaving': 0.63; 'limit': 0.65; 'situation': 0.67; 'increasing': 0.76; 'chrisa': 0.84; 'oscar': 0.84; 'to:none': 0.91 |
| 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:cc; bh=8wB1LDk+RwGB03Pa1PEmjj9QYKzaGr2jQBQp2DJPy4k=; b=aExnZjJXMh1LLtvFnzq/3ERJMEfaLcJr+aKsVrKxyyoQDNUBLRFc89bw7NHZdJfpCe XNPbSP85dqNmhwYeeVWcu9/tKIALaxE4lbavi02Bk7OAw9RV2+rj78cuvED2Yhz86Y6y Hfbc+NYmemOCAlMrn90WRt3E5z65O1PIer41FfHiLxJGQ2FmAoVUC1sVHmzU+O88oRgV RWGOip/Io0GwDnDfRyvlsFcjg8KvoDuxjI2vVfTnqQDdxD431+8P+B/F/LOFuB50FVv/ jHlKzJMAXht/+sUz+z1GWd8Je2ivPUtYh/LUixfpN7CgdRxqQUoqJ5g1A27sxGG3rElL gxvw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=8wB1LDk+RwGB03Pa1PEmjj9QYKzaGr2jQBQp2DJPy4k=; b=lLWl17VJtOMv49hyIKqYd9oJYD5a+zuE7u2xHWwGqkfIUpk2vQ3eR+pai8msrmiQkQ 08A7sME+YCjBuZw8zm3d6T8gBJjPYI9DMnNAgw21ZATFm/II3zfDPtjSHArIJKoeciBq XWkd5iWG6reL3zwm0fXEAvzxLjtzwT742N5g+7duQ6i4+7I//pwYiWMRnxvpWvjbFkYd nONlmu4UZUdRSRbr4aoZ+HBlT5BIWpwWMu45uIjdCdmJYkCDOmatJ2+JPH0qbfUgLCvx U0qDHjSm+Pdcrcw2Y8tbrjziYSIirnT73Ujuf4ckVZULDsnup5wLgZcaEXejaEUTwZtL K4DA== |
| X-Gm-Message-State | AOPr4FUIOgjDoVUBipxkqkO1mx0dkDUxnf8JYiAJVdsRiLXT/6RKk4ESgh8OynIHlna0SxCY+kNCvTJ+ut3fvg== |
| X-Received | by 10.107.18.232 with SMTP id 101mr3956004ios.157.1461250947691; Thu, 21 Apr 2016 08:02:27 -0700 (PDT) |
| In-Reply-To | <CAHVvXxQ=qbfxZAkznhFEpyNv-7WdFYzvJiQxrOzi9Ep7zanzaA@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAPTjJmpa8x3r_Y0Q-gZxHk-eLUH=wh=BpSJOwBGrE=OkgStmfg@mail.gmail.com> |
| X-Mailman-Original-References | <571843f9$0$1585$c3e8da3$5496439d@news.astraweb.com> <CAHVvXxTCQT0Tp3-Pd0O5mqSMDA6s=dqj+DDTpkq1AvYoCYs-7Q@mail.gmail.com> <mailman.7.1461228807.23626.python-list@python.org> <5718c457$0$1605$c3e8da3$5496439d@news.astraweb.com> <CAHVvXxQAPP8-31Nb3vM+=O4wYpXEuH1FH3n05N59KnqpC8C0PQ@mail.gmail.com> <CAPTjJmrp7ufKa194h4RrCh0F2y0FuDqaUkcV6-B-sHDWvosdKA@mail.gmail.com> <CAHVvXxQ=qbfxZAkznhFEpyNv-7WdFYzvJiQxrOzi9Ep7zanzaA@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:107455 |
Show key headers only | View raw
On Fri, Apr 22, 2016 at 12:30 AM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote: > On 21 April 2016 at 15:12, Chris Angelico <rosuav@gmail.com> wrote: >> On Fri, Apr 22, 2016 at 12:01 AM, Oscar Benjamin >> <oscar.j.benjamin@gmail.com> wrote: >>> In the recursive stack overflow case what you'll usually have is >>> >>> 1) A few frames leading up to the start of recursion >>> 2) A long repetitive sequence of frames >>> 3) A few frames at the end showing how the exception was ultimately triggered. >>> >>> You just need to find the cycle that makes that big long sequence. >> >> If the stack got overflowed, there won't usually be a part 3, as part >> 2 is the bit that hits sys.recursionlimit (unless increasing the >> recursion limit by a finite number would solve the problem). For other >> exceptions, yes, this is what you'd see. > > If you have: > > def f(x): > return g(x+1) > > def g(x): > x = h(x) # <-- stack can overflow inside here > return f(x+1) > > # etc. > > So you have a long sequence that goes f, g, f, g but at the end the > stack can overflow while (not recursively) calling h leaving a small > non-cyclic part at the end. Right, good point. Forgot about that. So this situation can be triggered by anywhere up to <cycle length> lines up. Not as helpful an optimization now. Oh well. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Detecting repeated subsequences of identical items Steven D'Aprano <steve@pearwood.info> - 2016-04-21 13:07 +1000
Re: Detecting repeated subsequences of identical items Ethan Furman <ethan@stoneleaf.us> - 2016-04-20 20:57 -0700
Re: Detecting repeated subsequences of identical items Ethan Furman <ethan@stoneleaf.us> - 2016-04-20 21:15 -0700
Re: Detecting repeated subsequences of identical items Chris Angelico <rosuav@gmail.com> - 2016-04-21 15:37 +1000
Re: Detecting repeated subsequences of identical items Michael Selik <michael.selik@gmail.com> - 2016-04-21 06:35 +0000
Re: Detecting repeated subsequences of identical items Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-21 18:05 +1000
Re: Detecting repeated subsequences of identical items Nobody <nobody@nowhere.invalid> - 2016-04-21 13:02 +0100
Re: Detecting repeated subsequences of identical items Michael Selik <michael.selik@gmail.com> - 2016-04-21 06:49 +0000
Re: Detecting repeated subsequences of identical items Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-04-21 08:54 +0200
Re: Detecting repeated subsequences of identical items Michael Selik <michael.selik@gmail.com> - 2016-04-21 07:05 +0000
Re: Detecting repeated subsequences of identical items Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2016-04-21 09:25 +0200
Re: Detecting repeated subsequences of identical items Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-04-21 09:53 +0100
Re: Detecting repeated subsequences of identical items Steven D'Aprano <steve@pearwood.info> - 2016-04-21 22:15 +1000
Re: Detecting repeated subsequences of identical items Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-04-21 15:01 +0100
Re: Detecting repeated subsequences of identical items Chris Angelico <rosuav@gmail.com> - 2016-04-22 00:12 +1000
Re: Detecting repeated subsequences of identical items Steven D'Aprano <steve@pearwood.info> - 2016-04-23 01:00 +1000
Re: Detecting repeated subsequences of identical items Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-04-21 15:30 +0100
Re: Detecting repeated subsequences of identical items Chris Angelico <rosuav@gmail.com> - 2016-04-22 01:02 +1000
Re: Detecting repeated subsequences of identical items Serhiy Storchaka <storchaka@gmail.com> - 2016-04-21 14:56 +0300
csiph-web