  
  def main():
      test = TestQuickSort()
      test.test_quick_sort(quick_sort)
      try:
          test.test_quick_sort(quick_sort_alt)
      except NameError:
          # Alternate solutions are only defined
          # in the solutions file
          pass
  
  
  if __name__ == '__main__':
      main() 
</s> remove     "    try:\n",
    "        test.test_quick_sort(quick_sort_alt)\n",
    "    except NameError:\n",
    "        # Alternate solutions are only defined\n",
    "        # in the solutions file\n",
    "        pass\n",
 </s> add  </s> remove     "    try:\n",
    "        test.test_quick_sort(quick_sort_alt)\n",
    "    except NameError:\n",
    "        # Alternate solutions are only defined\n",
    "        # in the solutions file\n",
    "        pass\n",
 </s> add  </s> remove   {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pythonic-Code\n",
    "\n",
    "The following code from [Stack Overflow](http://stackoverflow.com/questions/18262306/quick-sort-with-python) is very concise, although it might be a little difficult to read:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def quick_sort_alt(arr):\n",
    "    if len(arr) <= 1:\n",
    "        return arr\n",
    "    else:\n",
    "        return quick_sort_alt([x for x in arr[1:] if x < arr[0]]) + [arr[0]] + quick_sort_alt([x for x in arr[1:] if x >= arr[0]])"
   ]
  },
 </s> add  </s> remove     "    if len(data) < 2:\n",
 </s> add     "    if data is None or len(data) < 2:\n", </s> remove     "* Space: O(n), n extra space, n recursion depth, generally not stable"
 </s> add     "* Space: O(n+m), n = number of elements, m = recursion depth\n",
    "\n",
    "Most implementations are not stable."
  
  def main():
      test = TestQuickSort()
      test.test_quick_sort(quick_sort)






  
  
  if __name__ == '__main__':
      main() 
keep keep keep keep replace replace replace replace replace replace keep keep keep keep
 Polish quicksort challenge and solution

Add None input test case.  Remove difficult to read 'Pythonic' solution.  Update space complexity discussion. 
sorting_searching/quick_sort/test_quick_sort.py