PEP 317: Eliminate Implicit Exception Instantiation
Steven Taschuk
staschuk at telusplanet.net
Tue Jun 10 18:04:19 EDT 2003
Quoth Bernhard Herzog:
> Steven Taschuk <staschuk at telusplanet.net> writes:
[issuing warnings for use of sys.exc_{type, value, traceback}]
> > I agree entirely, but I don't see how such warnings could be
> > implemented. How can you hook into access of specific globals?
>
> exc_* are not globals, they're attributes of the sys module.
What's the difference between globals and module attributes?
> What you could do, I think, is turn sys into an instance of a subclass
> of module and make exc_traceback and friends properties in that new
> subclass whose get functions simply return the appropriate value from
> sys.exc_info(). That would actually solve the bug wrt. threading and the
> get function could also issue a warning.
That seems plausible -- though Guido recently reiterated on py-dev
his dislike of the idea of class-like attribute access for
modules. In his words: "When you want a class, use one. :-)".
--
Steven Taschuk o- @
staschuk at telusplanet.net 7O )
" (
More information about the Python-list
mailing list