TAblE 12-3:
Warning Message Categories
ClASS
dESCRIPTIoN
DeprecationWarning
Used to display warnings about applications that use deprecated
(outdated) features. Normally, these warnings provide an alterna-
tive feature you should use in place of the deprecated feature.
548592c12.indd 250
2/24/10 12:48:47 PM
www.finebook.ir
Understanding IronPython Warnings
❘
251
ClASS
dESCRIPTIoN
FutureWarning
Used to display warnings about applications that use features
that will change sometime in the future. For example, the class,
method, attribute, or function might change in an update of the
Python specification. In most cases, you should keep the future
update in mind, but not change your application today unless
the new feature is available and debugged.
ImportWarning
Triggered when an application imports a module. The module
is still usable and likely doesn’t contain any problems (unless
you see other warnings). The interpreter generally ignores
these warnings.
PendingDeprecationWarning
Used to display warnings about applications that use
features that will be deprecated sometime in the future (as
opposed to the change indicated by the FutureWarning cat-
egory). In most cases, you won’t need to change your applica-
tion immediately, but you should change it to use an updated
feature soon.
RuntimeWarning
Specifies that one or more features are based on suspect run-
time functionality (such as modules that aren’t fully tested). In
most cases, this warning indicates that your application is likely
to fail more often or suffer other reliability issues.
SyntaxWarning
Indicates that the application will run, but that it contains some
suspect syntax. Perhaps the syntax isn’t approved or is simply
non-standard. Finding standardized methods for creating the
application syntax is a good way to avoid this warning.
UnicodeWarning
Triggered whenever an application experiences some problem
with Unicode implementation. Although this warning may not
affect some languages, it could affect languages that rely on an
extended character set.
UserWarning
Provides the default category for the
warn()
function. This
warning level is for issues related to user code. For example,
input from a user code function is supposed to provide the loca-
tion of a logging file on disk, but your module can’t find the log-
ging file. Your code won’t fail without the information, but it can’t
create the logging information either.
Warning
Provides the implementation of all warning subclasses.
It’s a subclass of the
Exception
class. This is a warning
category that you use to create new warning categories.
There is never a good reason to use this category to generate
warning messages.
548592c12.indd 251
2/24/10 12:48:47 PM
www.finebook.ir
Do'stlaringiz bilan baham: |