Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

มี Python Object Inspector หรือไม่?

ไม่มี Built-in Function หรือ Normal Function ตัวเดียวที่ทำหน้าที่เป็น Object Inspector ใน Python มี Functions เช่น type(), dir(), vars() หรือ Modules เช่น inspect ที่ใช้หา Attributes, Properties และ Methods ของ Object ใดๆ ที่อยู่ภายใต้การตรวจสอบ

มี Functions อื่นๆ เช่น id(), getattr(), hasattr(), globals(), locals(), callable() ที่มีประโยชน์ในการมองเข้าไปใน Object เพื่อรู้ Attributes และ Methods