Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c01/c01_29 #68

Open
utterances-bot opened this issue Apr 1, 2024 · 1 comment
Open

c01/c01_29 #68

utterances-bot opened this issue Apr 1, 2024 · 1 comment

Comments

@utterances-bot
Copy link

1.29 局部/全局变量傻傻分不清 — Python黑魔法手册 1.0.0 documentation

https://magic.iswbm.com/c01/c01_29.html

Copy link

hhaxzmic commented Apr 1, 2024

第一段代码与第二段代码的主要差别在于对全局变量的处理;
第一段代码尝试修改全局变量而未使用global关键字引发错误,而第二段代码只是读取全局变量的值,所以没有问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants