Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'welcome.': 0.07; 'python': 0.09; 'typed': 0.09; 'language,': 0.11; 'programmer': 0.11; 'interfaces': 0.15; 'classes:': 0.16; 'principal.': 0.16; 'typing': 0.17; 'to:name :python-list@python.org': 0.20; 'thanks.': 0.21; 'programming': 0.23; 'this:': 0.23; 'strongly': 0.27; 'post': 0.28; 'assert': 0.29; 'comments': 0.33; 'from:addr:live.com': 0.33; 'to:addr :python-list': 0.33; 'languages': 0.33; 'two': 0.37; 'being': 0.37; 'skip:l 20': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'between': 0.63; 'offer': 0.65; 'skip:m 50': 0.65; 'lack': 0.71; 'charset:windows-1251': 0.97 X-Originating-IP: [213.130.16.2] From: Andriy Kornatskyy To: "python-list@python.org" Subject: duck typing assert Date: Thu, 8 Nov 2012 20:30:02 +0300 Importance: Normal Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 08 Nov 2012 17:30:02.0593 (UTC) FILETIME=[AF564510:01CDBDD6] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352395870 news.xs4all.nl 6989 [2001:888:2000:d::a6]:38557 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32965 People who come from strongly typed languages that offer interfaces often a= re confused by lack of one in Python. Python=2C being dynamic typing progra= mming language=2C follows duck typing principal. It can as simple as this: assert looks(Foo).like(IFoo) The post below shows how programmer can assert duck typing between two Pyth= on classes: mindref.blogspot.com/2012/11/python-duck-typing-assert.html Comments or suggestions are welcome. Thanks. Andriy Kornatskyy =