rospy sleep is another way like time.sleep to pause a thread from running at its full possible rate and taking unnecessary resources. A while true would take up alot of resources otherwise.