Uses of Python's “from” keyword?
问题 Are there any other uses for Python's "from" keyword aside from import statements? 回答1: 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. 回答2: 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: