Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Murach's Python Programming: catching exceptions

 
Ranch Hand
Posts: 460
6
Netbeans IDE Oracle Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Which brings this book in comparison with other books of Python?

Nowadays I saw that Python is used very much in many applications, GitHub is written in Python together with other language.

Also Python is used for automated testing.

About exceptions, what is the difference between the catching exceptions in Python comparative to Java?

Thanks in advance
 
Author
Posts: 130
13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dana,

Compared to other books, this book is a solid introduction to the Python language. Some books are huge and overwhelming, covering both Python 2 and 3 at the same time, web programming with Python, and more. Other books are so short and simple that they don't give you an idea of how powerful Python can be. Our book covers only Python 3 in a way that attempts to give you a solid foundation in the Python language without moving too far down the road into any specialized areas such as web programming.

As for exceptions, Python uses a try statement that's similar to Java's try statement. However, there are no checked exceptions in Python, so you're never forced to catch exceptions. As a result, you only need to catch exceptions when you encounter them during testing. This often speeds development by saving you from having to write a lot of unnecessary exception handling code.

Thanks!

 
Dana Ucaed
Ranch Hand
Posts: 460
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting thing about exceptions in Python.

Thank you for your response.

 
Ranch Hand
Posts: 72
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joel Murach wrote:
As for exceptions, Python uses a try statement that's similar to Java's try statement. However, there are no checked exceptions in Python, so you're never forced to catch exceptions. As a result, you only need to catch exceptions when you encounter them during testing. This often speeds development by saving you from having to write a lot of unnecessary exception handling code.



As I had read from an online java source:

Checked exceptions are checked at compile time by the JVM and its related to resources(files/db/stream/socket etc).
The motive of checked exception is that at compile time if the resources are not available the application should define an alternative behaviour to handle this in the catch/finally block.

The Java compiler forces you to either catch checked exceptions or declare them in the method signature.It was supposed to improve program safety

I think this make an advantage to the exception handling mechanism over its counterpart of Python.

Regards,
 
Can you smell this for me? I think this tiny ad smells like blueberry pie!
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic