On Fri, Jul 2, 2010 at 12:31 AM, Stefan Behnel <stefan...@behnel.de> wrote: > Glyph Lefkowitz, 02.07.2010 06:43: >> >> On Jul 2, 2010, at 12:28 AM, Steven D'Aprano wrote: >> >>> This question was inspired by something asked on #python today. Consider >>> it a hypothetical, not a serious proposal. >>> >>> We know that many semantic errors in Python lead to runtime errors, e.g. >>> 1 + "1". If an implementation rejected them at compile time, would it >>> still be Python? E.g. if the keyhole optimizer raised SyntaxError (or >>> some other exception) on seeing this: >>> >>> def f(): >>> return 1 + "1" >>> >>> instead of compiling something which can't fail to raise an exception, >>> would that still be a legal Python implementation? >> >> I'd say "no". Python has defined semantics in this situation: a TypeError >> is raised. > > So, would it still be Python if it folded > > 1 + "1" > > into > > raise TypeError() > > at compile time? > > Stefan >
This question has an easy answer - can you possibly tell the difference? Cheers, fijal _______________________________________________ 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