Where is the “from __future__ import braces” code?

前端 未结 1 349
挽巷
挽巷 2021-02-02 05:48

I was wondering what is exactly the code that executed on the command:

>>> from __future__ import braces
SyntaxError: not a chance

so,

相关标签:
1条回答
  • 2021-02-02 05:54

    The code is in future.c:

    future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
    ...
      else if (strcmp(feature, "braces") == 0) {
        PyErr_SetString(PyExc_SyntaxError,
            "not a chance");
        PyErr_SyntaxLocation(filename, s->lineno);
        return 0;
      }
    
    0 讨论(0)
提交回复
热议问题