How can one create new scopes in python

后端 未结 12 1237
渐次进展
渐次进展 2020-12-10 01:08

In many languages (and places) there is a nice practice of creating local scopes by creating a block like this.

void foo()
{
     ... Do some stuff ...

             


        
12条回答
  •  醉话见心
    2020-12-10 01:30

    A scope is a textual region of a Python program where a namespace is directly accessible. “Directly accessible” here means that an unqualified reference to a name attempts to find the name in the namespace...

    Please, read the documentation and clarify your question.

    btw, you don't need if(TRUE){} in C, a simple {} is sufficient.

提交回复
热议问题