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 trial

Python Object-Oriented Python Instant Objects Method Arguments

The pattern of "Return...and..."

The pattern of "Return...and..." used in the statement: return self.sneaky and light_level < 10 was not explained very well. Can somebody provide a link to documentation of this?

2 Answers

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

It is just returning the result of the evaluated expression (self.sneaky and light_level < 10) which can either be true or false.

For example, both self.sneaky must be True and light_level < 10 to return True (basic and processing), otherwise it will return False.

Return Statement Doc

That helps, thanks.