Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKerrick Hahn
5,728 PointsWould it not have been more appropriate to name the self.is_moving method as self.is_stopped?
She set the self.is_moving method default False. Would it not have been more appropriate to set the default method as self.is_stopped and True.
2 Answers
Chris Freeman
Treehouse Moderator 68,454 PointsGood question. Both would work. It comes down to how the coder wants the code to read. They may choose:
# is the not moving
if car.is_moving == False:
# or simply
if not car.is_moving:
## VS
# the car is not moving
if car.is_stopped == True:
# or simply
if car.is_stopped:
Sometimes it is worth the effort to reread code and reverse semantics to improve readability. Some times both the positive and the negative cases are used in the code, so one would not read as simply as the other.
Post back if you have more questions. Good luck!!
Kerrick Hahn
5,728 PointsHahah thought so!! Thank you for answering!