Am 02.07.2010 18:51, schrieb Craig Citro:
>> But you would be taking a module that will compile and making it 
>> uncompilable.
>>
> 
> You're absolutely right, and since I definitely *don't* think that the
> program "raise TypeError" should cause a CompileError, you could say
> it's safer to have a simple rule like "vaild syntax => will compile"
> -- it's probably a slippery slope once you start deciding which bits
> of semantics raise CompileErrors and which don't.
> 
> However, in this particular case, here's a question: *why* would
> someone write "return 1 + '1'"? Did they do it *knowing* what would
> happen, or because they just didn't realize it was just an error?
> 
>  * If they knew what it was going to do, then I'd say shame on them --
> they should have just raised a TypeError instead, and anyone who comes
> along to read or maintain that code would thank them for the change.

"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 :)

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

_______________________________________________
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