Easy Python tutorials | Namespaces and Scope in Python

Publié le: 23 mars 2026
sur la chaîne: EasyDataScience
14
1

In Python, two objects with same name can refer to different things, depending on where they are defined or referenced. Python programs have various namespaces—sections within which a particular name is unique and unrelated to the same name in other namespaces. Each function defines its own namespace.
If you define a variable called x in a main program and another variable called x in a function, they refer to different things. But the walls can be breached: if you need to, you can access names in other namespaces in various ways.
The main part of a program defines the global namespace; thus, the variables in that namespace are global variables.



#python
#namespace
#scope
#easydatascience2508


Sur cette page du site, vous pouvez voir la vidéo en ligne Easy Python tutorials | Namespaces and Scope in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur EasyDataScience 23 mars 2026, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 14 fois et il a aimé 1 téléspectateurs. Bon visionnage!