<div dir="ltr">Vorrei aprire una discussione senza cadere nella trappola del<div>expert beginner. </div><div>In Python in quali casi e' preferibile usare eccezzioni o in quali casi e' preferibile usare return codes. Secondo la teoria, spiegata in <strong style="margin:0px;padding:0px;border:0px;font-size:15px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries</strong><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px">, </span>:</div><div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px">"Exceptions integrate well with object-oriented languages. Object-oriented languages tend to impose constraints on member signatures that are not imposed by functions in non-OO languages. </span><strong style="margin:0px;padding:0px;border:0px;font-size:15px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">For example, in the case of constructors, operator overloads, and properties, the developer has no choice in the return value.</strong><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px"> For this reason, it is not possible to standardize on return-value-based error reporting for object-oriented frameworks. </span><strong style="margin:0px;padding:0px;border:0px;font-size:15px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">An error reporting method, such as exceptions, which is out of band of the method signature is the only option.</strong><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px">"</span><br></div><div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px"><br></span></div><div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px">Ma ne la vita quotidiana si apprende dell'esperienza e non solo dalla teoria. Durante la vostra esperienza vi e' capitato di decidere questo?</span></div><div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:19.5px"><br></span></div></div>