Understanding Method Chaining in Python