title: Proper return value for __len__ for an object that acts as an infinite sequence
body: <p>I am writing a python class that acts as an immutable, infinite sequence.</p>
  
  <p>The class does not use a generator to access this infinite sequence, rather it generates a value for an arbitrary index in the sequence according to an algorithm within the <code>__getitem__</code> method.</p>
  
  <p>I am curious what the best way to handle the <code>__len__</code> method of such an object is. Ideally, I would just return <code>float("inf")</code> through <code>__len__</code>. However, the <code>len()</code> function that calls an object's <code>__len__</code> method behind the scenes requires a somewhat specific value.</p>
  
  <p>If <code>__len__</code> is set to return float("inf") or decimal.Decimal("Infinity"), <code>len()</code> rejects it by raising a TypeError. It also rejects the value of "-1" which would imply that the sequence is infinite. Furthermore, when I tried using an infinity class that I happen to have written earlier that <em>does</em> in fact inherit from <code>int</code>, <code>len()</code> for whatever reason returned 0.</p>
  
  <p>While it isn't really a major inconvenience to allow the value to just be "0", and while a class like this is very unusual, I am still curious to know, is there a good way to handle the length attribute of a class that is an infinite sequence?</p>