Python or PHP?

John Bokma john at castleamber.com
Mon Apr 25 15:30:59 EDT 2005


Ville Vainio wrote:

>>>>>> "John" == John Bokma <postmaster at castleamber.com> writes:
> 
>     John> Who told you Perl can't do exceptions?
> 
> Back when I learned (heh, I never 'really' learned, but knew enough to
> write programs in it) perl, almost every function call was followed by
> 
> or die("blah");

Yup, which throws an exception.

> i.e. the user had to check the error code.
>
> If the function would have
> raised an exception instead, such check would be redundant because it
> would never be executed.

true, Perl doesn't throw exceptions for you when an "or die" is required.

> In Python, all error conditions raise exceptions. If python
> 'supported' exceptions but standard library functions didn't raise
> them, the feature would not be worth much.

Agreed, one common error that beginners make a lot is not throwing 
exceptions.

-- 
John                               MexIT: http://johnbokma.com/mexit/
                           personal page:       http://johnbokma.com/
        Experienced programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html



More information about the Python-list mailing list