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 trialMichael Van Dusen
12,136 PointsDoes "Shadows" warning suggest this code is "Not Pythonic?"
I am writing the code for this lesson in Intellij and get a warning on new_item in the function:
def add_to_list(new_item):
that says 'Shadows name 'new_item' from outer scope." Is there a better way of writing this to avoid this warning?
1 Answer
Michael Hulet
47,913 PointsThat warning means that at some point, add_to_list
was defined twice, and they conflict with each other. If you rename one of them, that warning should go away