前の章では、知識と名前空間スコープを説明し、今の名前空間のpython3機能についての話をしましょう。
まず、関数名の性質
関数名の性質は、16進アドレスメモリ機能本体自体がである变量
、それは関数自体がポインタであると言うことができ指针
、以下のように:
def hello():
print("hello")
print(hello)
# 控制台输出:
<function hello at 0xcc485270>
それは機能の性質上の変数名であるので、以下のように、それは、他の変数に割り当てることができます。
def hello():
print("hello")
a = hello
print(a)
# 控制台输出:
<function hello at 0xcc485270>
関数呼び出しは、関数名は、英語の括弧プラス1である、すなわち函数名()
として、理解することができる函数地址()
、次のとおりです。
def hello():
print("hello")
a = hello
print(a)
# 通过变量a调用函数hello()
a()
# 控制台输出:
<function hello at 0xcc485270>
hello