On Sat, Jul 3, 2010 at 3:13 AM, Craig Citro <craigci...@gmail.com> wrote:
>> "1/0" is much faster to type than "raise SomeError" and serves the same
>> purpose sometimes for debugging purposes.  Let's not forget that not
>> all code is written for eternity :)
>>
>
> Doesn't "raise" do the same thing for just two extra characters?

No, raise on its own is only valid in an exception handler. Writing
"1/0" is at least somewhat common as an idiom for forcing a
ZeroDivisionError in examples and in test harnesses (I know I have
used it for both of those things many times).

Given the diverse range of uses Python is put to, moving things from
runtime to compile time can definitely have significant unexpected
consequences (hence why many of us would be hesitant to consider an
implementation that made such changes to be an actual Python
implementation).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
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