On Wed, Aug 10, 2016 at 4:51 AM, Michael Selik <michael.se...@gmail.com> wrote:
> "File-like" is a good example. Rather than go through the frustration of a
> formal definition for what is file-like, stay productive and flexible with
> duck typing. Objects that don't have the appropriate methods or attributes
> will cause a TypeError or AttributeError. If you're passing in the wrong
> kind of object, you'll find out almost as soon as you write the code
> (because you test early and often), just as you would with a statically
> analyzed type system.

It's slightly delayed; with Python, you have to actually execute the
code path in question, whereas a static type system would detect it at
the compilation stage. So it may depend on the quality of your
testing. MyPy may be able to help there.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to