Alex Martelli wrote:
> I wonder if there's some desiderata left for future Python versions to
> make this standard behavior easier (for C-coded, Python-coded, and
> Cython-coded classes, ones made by SWIG, etc) without too much black
> magic...

I think the standard exception hierarchy should grow additional standard
fields. E.g. AttributeError should have attributes 'type','name', or
perhaps even 'object','name'. TypeError should have attributes
'expected', 'actual' (or, again, 'expected', 'object'). Also, some
languages support nested exceptions (attribute 'inner'); usefulness of
this concept should be reviewed.

And so on - that might produce quite a large PEP. As 3.0 missed the
chance to fix this, compatibility is also an issue. It might be possible
to overload exception constructors on the number of parameters, or using
keyword parameters for the new way of filling the exception.

And no, I don't volunteer to write this PEP :-)

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to