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


Groups > comp.lang.python > #51055

Re: odd behavoiur seen

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 22 Jul 2013 13:42:47 -0500
From Chris Hinsley <chris.hinsley@gmail.com>
Newsgroups comp.lang.python
Date Mon, 22 Jul 2013 19:42:47 +0100
Message-ID <2013072219424735368-chrishinsley@gmailcom> (permalink)
References <2013072219364160391-chrishinsley@gmailcom>
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Subject Re: odd behavoiur seen
User-Agent Unison/2.1.10
Lines 28
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-O9oQ3aWTx5Ft/wjsr8QWtzgYOUYpm4VVy53z7vEsD5Hrs/LWNa/NG81w2/puOI/yWHJqUlGa9JfhFuX!U6ogDF8R5QLmvNqSyLHMfc0jBGipRTCGieSpJ8l2N86BCN9kVEZRXt9p8Ut96wlRJjE=
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1762
Xref csiph.com comp.lang.python:51055

Show key headers only | View raw


On 2013-07-22 18:36:41 +0000, Chris Hinsley said:

> Folks, I have this decorator:
> 
> def memoize(maxsize):
>     def _memoize(func):
>         lru_cache = {}
>         lru_list = []

Other clues, I use it on a recursive function:

@memoize(64)
def next_move(board, colour, alpha, beta, ply):
    if ply <= 0:
        return evaluate(board) * colour
    for new_board in all_moves(board[:], colour):
        score = -next_move(new_board, -colour, -beta, -alpha, ply - 1)
        if score >= beta:
            return score
        if score > alpha:
            alpha = score
    return alpha

And I notice I don't get the strange problem on a non-recursive 
function ! Or at least I don't seam to.

Chris

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


Thread

odd behavoiur seen Chris Hinsley <chris.hinsley@gmail.com> - 2013-07-22 19:36 +0100
  Re: odd behavoiur seen Chris Hinsley <chris.hinsley@gmail.com> - 2013-07-22 19:42 +0100
    Re: odd behavoiur seen Peter Otten <__peter__@web.de> - 2013-07-22 21:47 +0200
      Re: odd behavoiur seen Chris Hinsley <chris.hinsley@gmail.com> - 2013-07-22 21:12 +0100

csiph-web