[Tutor] A few comparative perl/python questions
lumbricus@gmx.net
lumbricus@gmx.net
Mon, 29 Jul 2002 12:43:29 +0200 (MEST)
Hello!
> Foo() || die
>
> idiom is possible in Python:
>
> Foo() or raise SystemExit
Now this is beautyful.
> The '||' is just Perl's logical OR and relies on
> short-circuit evaluation such that if the first
> value( Foo() ) is true we don't need to evaluate
> the second item. Pythons 'or' operator does the same.
>
> However although easy to translate it's not very
> Pythonic and I don't recommend it...
Is there a special reason?
I like it.
> Just noting the possibility.
>
> Alan G.
>
Greetings J"o!
--
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net