<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andrew Taylor on Medium]]></title>
        <description><![CDATA[Stories by Andrew Taylor on Medium]]></description>
        <link>https://medium.com/@andrew_taylor?source=rss-8b7abd033516------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cujVJ0vcHXcWuHeg.jpg</url>
            <title>Stories by Andrew Taylor on Medium</title>
            <link>https://medium.com/@andrew_taylor?source=rss-8b7abd033516------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 21:50:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andrew_taylor/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Python Can Do Infinite Binary Operations Per Second]]></title>
            <link>https://medium.com/@andrew_taylor/python-can-do-infinite-binary-operations-per-second-30fe913c00d1?source=rss-8b7abd033516------2</link>
            <guid isPermaLink="false">https://medium.com/p/30fe913c00d1</guid>
            <dc:creator><![CDATA[Andrew Taylor]]></dc:creator>
            <pubDate>Sun, 27 Oct 2013 20:31:42 GMT</pubDate>
            <atom:updated>2013-10-27T20:31:42.733Z</atom:updated>
            <content:encoded><![CDATA[<h4>…as long as infinity of them are the same</h4><p>A few days ago I discovered something lovely that Python does with integers: they’re all arbitrary precision by default.</p><p>In C, for example, an ‘int’ is 32 bit and can store up to about two billion, and a ‘long’ is 64-bit and can store slightly over <em>nine billion</em> billion. That’s obviously plenty for any real-life programming except perhaps <a href="http://orteil.dashnet.org/cookieclicker/">Cookie Clicker</a> or <a href="http://aperiodical.com/2013/10/jos-perfect-cuboid/">hunting for a perfect cuboid</a>, but in Python you can store any integer exactly, because its integers are essentially infinity-bit. So zero is infinite zeros, one is infinite zeros and a one, two is infinite zeros, a one and a zero, and so on.</p><p>In C, you can do ‘bitwise’ operations. 0011 ‘bitwise and’ 0101 is 0001 — because only digits where both numbers have a 1 are 1. By the same token, 0011 ‘bitwise or’ 0101 is 0111. In Python, you can do exactly that: the infinite strings of zeros don’t really figure so it ignores them, and 3 &amp; 5 = 1 just like in C.</p><p>In C, you can bit-shift integers, which is the binary equivalent of adding or removing zeros to multiply or divide by ten. Python does this too. C has to add a new zero to the end. Python doesn’t, because there are already infinite of them.</p><p>In C, negative one is encoded by making all 32 digits of the binary integer ones. In negative two, the last one is a zero, and so on. Python does that too — except in Python, negative one is encoded as an <em>infinite</em> string of ones.</p><p>And you can bitwise operate on them. You can take ‘bitwise not’ of zero and get negative one. You can ask for (3 &lt;&lt; 2) &amp; ~5 and it will just go ahead and work it out.</p><p>It’s just a thoroughly lovely implementation of something completely straightforward <em>once you wrap your head around</em> it but completely mind-melting right up until that point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30fe913c00d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>