Top-rated recipes tagged "peeking"http://code.activestate.com/recipes/tags/peeking/top/2012-07-03T17:00:20-07:00ActiveState Code RecipesWindowing an iterable with itertools (Python) 2010-04-15T18:45:41-07:00Daniel Cohnhttp://code.activestate.com/recipes/users/4172918/http://code.activestate.com/recipes/577196-windowing-an-iterable-with-itertools/ <p style="color: grey"> Python recipe 577196 by <a href="/recipes/users/4172918/">Daniel Cohn</a> (<a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/iterable/">iterable</a>, <a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/loop/">loop</a>, <a href="/recipes/tags/peeking/">peeking</a>, <a href="/recipes/tags/window/">window</a>). </p> <p>Oftentimes a programmer needs to peek into an iterator without advancing it, a task for which many good solutions already exist. But what if the intrepid coder needs a fast and pythonic way to 'window' the data? This recipe demonstrates how to wrap any iterable with a class that adds two methods, prev and peek.</p> For AMIGA-Heads Only. Peeking A Memory Address On A Classic AMIGA, Inside Text Mode Python. (Python) 2012-07-03T17:00:20-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578189-for-amiga-heads-only-peeking-a-memory-address-on-a/ <p style="color: grey"> Python recipe 578189 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/peek/">peek</a>, <a href="/recipes/tags/peeking/">peeking</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>For AMIGA-Heads Only...</p> <p>This code is purely for a minimum of a stock Classic AMIGA A1200(HD), E-UAE, and WinUAE running AMIGA OS3.0x to 3.1x. It will NOT work on any other platform!</p> <p>(It MIGHT work on AMIGA OS3.5x and 3.9x with Python 2.4.6, but totally untested and I hold no responsibility for the outcome when trying it.)</p> <p>It is a DEMO to peek a byte inside _ANY_ memory address inside the standard CPU 68EC020 16MB boundary.</p> <p>I experimented with this several years ago and have decided to finally release it. I do await the flak!</p> <p>It works from Python Versions 1.4.0 to 2.0.1 for the classic AMIGA.</p> <p>Ensure that the T: Volume exists on the running machine.</p> <p>See inside the code and text below it also as to how it works...</p> <p>Bazza, G0LCU...</p> peek ahead an iterator (Python) 2010-08-17T13:41:41-07:00Quintijn Hoogenboomhttp://code.activestate.com/recipes/users/4171692/http://code.activestate.com/recipes/577361-peek-ahead-an-iterator/ <p style="color: grey"> Python recipe 577361 by <a href="/recipes/users/4171692/">Quintijn Hoogenboom</a> (<a href="/recipes/tags/iter/">iter</a>, <a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/peek/">peek</a>, <a href="/recipes/tags/peeking/">peeking</a>). </p> <p>a merge of recipes 16.7 and 19.18 of the python cookbook (2nd edition).</p> <p>you can peek ahead more steps if needed, or just use the preview variable for the next item of the list.</p>