On Sat, 3 Jul 2010 11:39:07 am Greg Ewing wrote:
> Stefan Behnel wrote:
> > So, would it still be Python if it folded
> >
> >     1 + "1"
> >
> > into
> >
> >     raise TypeError()
> >
> > at compile time?
>
> It would have to be
>
>     raise TypeError("Exactly the message that would have been
> produced at run time")


Python doesn't make any guarantees about the message that exceptions 
display, so I don't think you need to match the message, just the 
exception. Anyone testing for specific exception messages is living in 
a state of sin and shouldn't complain when their code stops working. An 
implementation might choose to raise TypeError('is this the right place 
for an argument?') on alternate Tuesdays, and it would still meet the 
promises made by the language.


-- 
Steven D'Aprano
_______________________________________________
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