GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing mail.python.org — [Python-Dev] Warning Framework (PEP 230) [Python-Dev] Warning Framework (PEP 230)Guido van Rossum [email protected]Mon, 11 Dec 2000 19:39:31 -0500
> Since you must do "from warnings import warn" before using the warnings,
> then I think it makes sense to put the Warning classes into the warnings
> module. (e.g. why increase the size of the builtins?)
I don't particularly care whether the Warning category classes are
builtins, but I can't declare them in the warnings module. Typical
use from C is:
if (PyErr_Warn(PyExc_DeprecationWarning,
"the strop module is deprecated"))
return NULL;
PyErr_Warn() imports the warnings module on its first call. But the
value of PyExc_DeprecationWarning c.s. must be available *before* the
first call, so they can't be imported from the warnings module!
My first version imported warnings at the start of the program, but
this almost doubled the start-up time, hence the design where the
module is imported only when needed.
The most convenient place to create the Warning category classes is in
the _exceptions module; doing it the easiest way there means that they
are automatically exported to __builtin__. This doesn't bother me
enough to try and hide them.
--Guido van Rossum (home page: http://www.python.org/~guido/)
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |