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

Python library imports [Peewee]

On my computer if I type

from peewee import *

I don't get auto complete on things that are in the peewee framework.

Now when I do

import peewee

I get autocomplete to work. All I have to do is type peewee.CharField() for example to get the autocomplete.

Is there a downside to importing this way?

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,468 Points

No real downside. With autocomplete in your editor, the only downside is more text in the code which might make it slightly less readable.

However, in the Django framework, the fields are in the models module so every field is prefaced with "models."

from django.db import models

class Person(models.Model):
    name = models.CharField(max_length=30)

So it's not really different.

Awesome! Thanks for clearing that up, Chris!