Import with a comma after the as
import, python, syntax
Solution
That line tells Python to import `TestCase` and `Twill` from the package `flask.ext.testing`, but to import `TestCase` under the name of `Base`.
From the docs:
If the module name is followed by `as`, then the name following `as` is bound directly to the imported module.
Below is a demonstration with the `search` and `match` functions from the `re` module:
>>> from re import search as other, match
>>> match # The name match refers to re.match
<function match at 0x02039780>
>>> other # The name other refers to re.search
<function search at 0x02048A98>
>>> search # The name search is not defined because it was imported as other
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'search' is not defined
>>>
Problem
I was looking at a repo and came across a somewhat weird line ``` from flask.ext.testing import TestCase as Base, Twill ``` What does it mean to import like this? I have not seen it before and unfortunately it's rather hard to google.