Update partition.py

fix backward search bug