Uses of Python's "from" keyword?
No and yes.
According to the official Python 2.7.2 grammar, the only occurrence of the word from
is in the clause import_from
, so no.
In the Python 3.1.3 grammar a new clause
raise_stmt: 'raise' [test ['from' test]]
appears, so yes.
There is a new syntax for delegating to a subgenerator in Python 3.3 which uses the from
keyword.
In Python 2.x, the only use of from
is for the from x import y
statement. However, for Python 3.x, it can be used in conjunction with the raise
statement, e.g.:
try:
raise Exception("test")
except Exception as e:
raise Exception("another exception") from e