Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet258/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   254   255   256   257   258   259   260   261   ...   453
TAblE 12-2: 
Standard Warning Actions
ACTIoN TyPE 
dESCRIPTIoN
error 
Turns all matching warnings into exceptions, which means the application will 
terminate when it encounters the warning unless you provide the required 
exception handling.
ignore 
Disregards the matching warnings so that the interpreter doesn’t print them 
and they don’t affect application execution. Using this action can hide poten-
tially useful warnings from view and make debugging significantly harder.
continues
548592c12.indd 243
2/24/10 12:48:44 PM
www.finebook.ir


244

CHAPTER 12
Debugging ironPython APPlicAtions
ACTIoN TyPE 
dESCRIPTIoN
always 
Prints the matching warnings, even if the interpreter would normally ignore 
it. Using this action displays more information, which could make debugging 
easier, but also means that the screen will become clogged with unnecessary 
warnings at times.
default 
Performs the default warning action of printing the first occurrence of matching 
warnings for each location where the interpreter issues the warning. A warn-
ing could appear more than once for each module. For example, it can appear 
once in each class within the module.
module 
Prints the first occurrence of matching warnings just one time for each module, 
even if the interpreter would print the warning more often. Using this action 
displays less information than the default action, which means that the console 
screen will remain clearer. However, you could miss essential warnings you 
need to debug your application.
once 
Prints only the first occurrence of matching warnings no matter where the 
warning appears. This action is useful when you want to fix each warning 
immediately. However, it’ll definitely hide useful debugging information if you 
plan to run your application for an extended interval.
It’s important to work with a few warnings to see how filtering works because filters are excep-
tionally important. In order to use warnings, you import the warnings module. Figure 12-1 shows 
a typical instance of the default action. Notice that the first time the code issues the 
warnings 
.warn(“deprecated“, DeprecationWarning)
warning, the interpreter displays a message. 
(Don’t worry too much about the specific arguments for the 
warnings.warn()
function for right 
now; you see them explained in the “Working with Messages” and “Working with Categories” 
sections of the chapter.) However, the interpreter ignores the same warning the second time.
If you change the message, however, the interpreter displays another message.
FIgURE 12-1: 
The default action displays each message just one time.
Of course, you could always associate a different action with the 
warnings 
.warn(“deprecated“, DeprecationWarning)
warning. To make this change, you can use the 
simplefilter()
function as shown in Figure 12-2. Now when you issue the warning, it appears 
every time.
TAblE 12-2 
(continued)
548592c12.indd 244
2/24/10 12:48:45 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   254   255   256   257   258   259   260   261   ...   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