11 AĞUSTOS 2009, Salı
Python yerel olmayan deyim
nonlocal do deyimi (Python 3.0 ve üstü), Python nedir?
Resmi Python web sitesinde belgeler var ve help("nonlocal"), ya da çalışmıyor.
CEVAP
11 AĞUSTOS 2009, Salı
Bu karşılaştırma, yerel olmayan kullanmadan:
>>> def outer():
x = 1
def inner():
x = 2
print("inner:", x)
inner()
print("outer:", x)
>>> outer()
inner: 2
outer: 1
Bu, yerel olmayan kullanma
>>> def outer():
x = 1
def inner():
nonlocal x
x = 2
print("inner:", x)
inner()
print("outer:", x)
>>> outer()
inner: 2
outer: 2
Bunu PaylaÅŸ:

Python 2'de yerel olmayan kelime.x...
Nasıl yerel olarak yüklü Python modüll...
Nasıl Kaldır/Python ile boş olmayan bi...
'eÅŸdeÄŸer && bir deyim s Python...
Bulma Yerel IP adresleri'In Pytho...