Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet439/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   435   436   437   438   439   440   441   442   ...   453
Using Garbage Collection
 

 
431
INTErAcTINg WITH THE INTErPrETEr AND ENvIroNmENT
The IronPython setup focuses more on .NET usage, rather than strict Python uses in some 
respects. For example, IronPython doesn’t provide access to the Standard Library by default. 
Chapter 6 explains techniques you can use to access the Standard Library and why this access is 
important in some situations.
IronPython and CPython also behave differently in some situations. In some cases, this behavior is 
by design or a necessity given the differing goals of the design teams. In other cases, the IronPython 
team plans to fix the error or has asked the Python community about the issue and the Python com-
munity has found it acceptable. In fact, some of the following behavior issues might be fixed with 
the next release of IronPython.
➤➤
The actual error output might not be changed in response to a change to 
sys.stderror
.
IronPython and CPython use different forms of command line editing support.




IronPython and CPython use differing command line options, which means that batch files 
created for one won’t necessarily work for the other.


Some 
sys
module hooks may not work at all or may work differently than those in CPython. 
For example, IronPython doesn’t implement the 
sys.getrefcount()
method.


It’s possible to access 
__dict__()

__module__()

__class__()
, and 
__init__()
at the 
global level, where CPython doesn’t allow global access.
uSINg gArBAgE collEcTIoN
CPython relies on an older method of keeping track of objects, reference counting, which is similar to 
the technique used in older Component Object Model (COM) applications. IronPython uses a newer 
garbage collector. Relying on a garbage collector is actually an advantage for the IronPython developer. 
The Python community as a whole has decided that using a garbage collector is acceptable. However, 
using a garbage collector has the following implications for the IronPython developer.
➤➤
No need to worry about circular references because the garbage collector ensures that such 
instances are properly collected.


There’s no guarantee as to when finalization occurs or system resources are freed. This has 
implications for people who constantly create and then free resources. The system could very 
well slow down when garbage collection occurs at inconvenient times.


Invoking the 
__del__()
method doesn’t immediately delete the affected resource. The dele-
tion occurs during the next garbage collection cycle.


Calling 
sys.getrefcount()
returns an 
AttributeError
because the 
sys
module doesn’t 
implement this feature.


CPython reuses 
tuple
objects in some cases, but this behavior doesn’t occur in IronPython.
548592bapp01.indd 431
2/24/10 12:50:00 PM
www.finebook.ir


548592bapp01.indd 432
2/24/10 12:50:00 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   435   436   437   438   439   440   441   442   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish