develooper Front page | perl.perl5.porters | Postings from January 2021

try catch except python

Thread Next
From:
Philip R Brenan
Date:
January 25, 2021 14:10
Subject:
try catch except python
Message ID:
CALhwFRmEZeyop5igczfHxBjGsyR4fAM_y-=oYinNpbp190EPbA@mail.gmail.com
Here is the Python equivalent of try/catch:

try:
    x = 1/0except:
    print('Something went wrong.')


Please note that *except* does not require a parenthesised parameter list.
And if they had used *fail *instead of *except* it would have not only made
sense, but it would have been shorter and easier to spell as well.

Are we so determined to look like Java, to the very last parenthesis, that
we are willing to abandon the important Perl  traditions of using short
words, making parentheses optional and leading the way rather than being
mere followers?  As Enzo Ferrari might have said to Lee Iacocca: "Torna
alla sua grande, brutta fabbrica, a fare le sue brutte macchinine".

-- 
Thanks,

Phil <https://metacpan.org/author/PRBRENAN>

Philip R Brenan <https://metacpan.org/author/PRBRENAN>

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About