PHP empty function in python
<p>I have the following PHP code, and for the life of me I can't think of a simple &amp; elegant way to implement around the empty() function in python to check if the index is defined in a list.</p>

<pre><code>$counter = 0;
$a = array();
for ($i=0;$i&lt;100;$i++){
  $i = ($i &gt; 4) ? 0 : $i;
  if empty($a[$i]){
    $a[$i]=array();
  }
  $a[$i][] = $counter;
  $counter++;
}
</code></pre>

<p>if I do </p>

<pre><code>if a[i] is None
</code></pre>

<p>then I get index out of range. However I am aware of ways to do it in multiple steps, but that's not what I wanted.</p>
