Python Scoping Rules: Mastering Class and Nested Scopes
Learn how Python resolves names inside classes and nested functions to avoid common scoping traps and write cleaner object-oriented code.
-
💬
مدرب ذكاء اصطناعي
اسأل عن أي درس واحصل على إجابة واضحة فورًا، في أي وقت. -
🕐
ابدأ في أي وقت
بلا جداول أو مواعيد نهائية — تعلّم بوتيرتك، وقتما يناسبك. -
🌐
بالعربية
الدروس والمهام والشهادة — كل ذلك بلغتك بالكامل.
حول هذه الدورة
Have you ever encountered a confusing NameError in Python, even though the variable was defined just a few lines above in your class? Python's scoping rules are elegant, but class-level scope behaves differently from what many developers expect. This text-based course guides you through the mechanics of Python's name resolution so you can write predictable, bug-free code. By reading through clear explanations and practical code examples, you will master how Python's namespace lookup works behind the scenes. You will learn why nested scopes—such as functions, list comprehensions, and generator expressions—ignore class-level variables, and how to implement clean workarounds. What you'll learn: Understand the foundational LEGB (Local, Enclosing, Global, Built-in) lookup rule; Discover how class-level namespaces differ from function and module scopes; Identify why nested functions and modern comprehensions cannot directly access class variables; Apply reliable design patterns to safely pass class-level data to nested scopes; Debug complex scoping errors and name resolution issues with confidence. We start with core definitions and basic scoping behaviors before exploring the specific mechanics of class scopes and nested environments. This course is perfect for beginner to intermediate Python developers who want to deepen their understanding of language internals. No advanced background is required—just a basic familiarity with writing Python functions and classes. Start reading today to demystify Python's scoping rules.
ما الذي ستحصل عليه
-
📜
شهادة إتمام
أضفها إلى ملفك على LinkedIn -
💬
مدرّس AI شخصي
عالق في دورة؟ اسأل مدرّسك المدمج أي شيء، في أي وقت. -
🎧
النسخة الصوتية مضمَّنة
تعلَّم أثناء تنقُّلك — دون شاشة -
♾️
وصول مدى الحياة
عُد متى شئت، بلا انتهاء -
📱
الهاتف أو الكمبيوتر
يعمل في أي مكان وعلى أي جهاز -
💸
استرداد خلال 14 يومًا
دون أسئلة -
⚡
قصير ومركَّز
2 ساعة 42 دقيقة من المحتوى التطبيقي
المراجعات
لا توجد مراجعات بعد — كن أول من يشارك تجربته.
المتعلمون أخذوا أيضًا
⚡ الأفضل للبداية
🎓 بشهادة
برمجة بايثون التطبيقية: التعلم من خلال بناء المشاريع العملية
شهادة
تطبيق عملي
DH 500
→
🔥 مطلوب
🎓 بشهادة
Professional Python: Build Structured Applications
شهادة
تطبيق عملي
DH 500
→
🔥 مطلوب
🎓 بشهادة
أنماط التصميم في Python: أسس البنية الموجهة للكائنات
شهادة
تطبيق عملي
DH 500
→
🔥 مطلوب
🎓 بشهادة
برمجة Python وتطوير التطبيقات
شهادة
تطبيق عملي
DH 500
→
الأسئلة الشائعة
ما الذي أحتاجه لأخذ هذه الدورة؟ +
يكفي هاتف أو كمبيوتر متصل بالإنترنت. بدون تثبيتات أو أجهزة خاصة.
كيف يمكنني الدفع؟ +
بالبطاقة عبر Stripe. لا نخزن بيانات البطاقة — يتولى Stripe ذلك بأمان.
هل يمكنني استرداد المال؟ +
نعم — استرداد كامل خلال 14 يومًا، دون أسئلة.
إلى متى يستمر وصولي؟ +
إلى الأبد. بمجرد الشراء، الدورة لك تعود إليها متى شئت.
هل سأحصل على شهادة؟ +
نعم. عند الإتمام ستحصل على شهادة يمكنك إضافتها إلى ملفك في LinkedIn.
مصمَّم للعاملين في
التقنية
التصميم
المالية
التسويق
الرعاية الصحية
التعليم
الضيافة
التصنيع
×2
اشحن مرة واحدة وادفع النصف
أضف DH 1,000 واحصل على 200 رصيد، بحيث تكلف كل دورة حوالي DH 125.00. لا تنتهي صلاحية الأرصدة أبداً.
DH 1,000
200 رصيد
DH 125.00 / دورة
أفضل قيمة
DH 2,500
550 رصيد
DH 113.64 / دورة
DH 5,000
1200 رصيد
DH 104.17 / دورة
الرصيد يصلح لأي دورة ولا ينتهي.