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

Why don't we import the whole flask library?

Hi, In flask basics we just import the methods that we need from flask and the line for the import is getting long (from flask import 1, 2, 3, 4, 5, 6) why don't just import flask or (from flask import *) ?

Thank you!

1 Answer

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

You only want to import what you are using. The only reason Peewee imports all is because they built it that way. For all (that I know of) others, you only want to import the pieces you are going to use. This helps make it clear what elements are coming from which import to other developers. Here's a longer explanation from StackOverflow.