Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1c157ea9
Kaydet (Commit)
1c157ea9
authored
Mar 31, 2009
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add is_declared_global() which distinguishes between implicit and
explicit global variables.
üst
9d2ee5de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
symtable.py
Lib/symtable.py
+3
-0
test_symtable.py
Lib/test/test_symtable.py
+2
-0
No files found.
Lib/symtable.py
Dosyayı görüntüle @
1c157ea9
...
@@ -190,6 +190,9 @@ class Symbol(object):
...
@@ -190,6 +190,9 @@ class Symbol(object):
def
is_global
(
self
):
def
is_global
(
self
):
return
bool
(
self
.
__scope
in
(
GLOBAL_IMPLICIT
,
GLOBAL_EXPLICIT
))
return
bool
(
self
.
__scope
in
(
GLOBAL_IMPLICIT
,
GLOBAL_EXPLICIT
))
def
is_declared_global
(
self
):
return
bool
(
self
.
__scope
==
GLOBAL_EXPLICIT
)
def
is_local
(
self
):
def
is_local
(
self
):
return
bool
(
self
.
__flags
&
DEF_BOUND
)
return
bool
(
self
.
__flags
&
DEF_BOUND
)
...
...
Lib/test/test_symtable.py
Dosyayı görüntüle @
1c157ea9
...
@@ -98,7 +98,9 @@ class SymtableTest(unittest.TestCase):
...
@@ -98,7 +98,9 @@ class SymtableTest(unittest.TestCase):
def
test_globals
(
self
):
def
test_globals
(
self
):
self
.
assertTrue
(
self
.
spam
.
lookup
(
"glob"
)
.
is_global
())
self
.
assertTrue
(
self
.
spam
.
lookup
(
"glob"
)
.
is_global
())
self
.
assertFalse
(
self
.
spam
.
lookup
(
"glob"
)
.
is_declared_global
())
self
.
assertTrue
(
self
.
spam
.
lookup
(
"bar"
)
.
is_global
())
self
.
assertTrue
(
self
.
spam
.
lookup
(
"bar"
)
.
is_global
())
self
.
assertTrue
(
self
.
spam
.
lookup
(
"bar"
)
.
is_declared_global
())
self
.
assertFalse
(
self
.
internal
.
lookup
(
"x"
)
.
is_global
())
self
.
assertFalse
(
self
.
internal
.
lookup
(
"x"
)
.
is_global
())
self
.
assertFalse
(
self
.
Mine
.
lookup
(
"instance_var"
)
.
is_global
())
self
.
assertFalse
(
self
.
Mine
.
lookup
(
"instance_var"
)
.
is_global
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment