Vorrei aprire una discussione senza cadere nella trappola del expert beginner. In Python in quali casi e' preferibile usare eccezzioni o in quali casi e' preferibile usare return codes. Secondo la teoria, spiegata in *Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries*, : "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. *For example, in the case of constructors, operator overloads, and properties, the developer has no choice in the return value.* For this reason, it is not possible to standardize on return-value-based error reporting for object-oriented frameworks. *An error reporting method, such as exceptions, which is out of band of the method signature is the only option.*"
Ma ne la vita quotidiana si apprende dell'esperienza e non solo dalla teoria. Durante la vostra esperienza vi e' capitato di decidere questo?
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python