Sie sind auf Seite 1von 9

To give an example of a namespace, the full length of which renders it impractical

to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.
To give an example of a namespace, the full length of which renders it impractical
to use, we will take a look at the User class in Django. Within the Django
framework, the User class is stored in django.contrib.auth.models.User. Many
projects use the object in the following way:
from django.contrib.auth.models import User # Use it as: User While this is fairly
clear, it might make someone think that the User class is local to the current
class. Doing the following instead lets people know that it is in a different
module:
from django.contrib.auth import models # Use it as: models.User This quickly
clashes with other models' imports though, so personally I would recommend the
following instead:
from django.contrib.auth import models as auth_models # Use it as auth_models.User
Here is another alternative:
import django.contrib.auth as auth_models # Use it as auth_models.User Conclusion
Now we should have some idea of what the Pythonic ideology is about. Creating code
that is: � Beautiful � Readable � Unambiguous � Explicit enough � Not completely
void of whitespace So let's move on to some more examples of how to create
beautiful, readable, and simple code using the Python style guide.

Das könnte Ihnen auch gefallen