Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.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.004 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; 'url:2012': 0.30; '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; 'charset:windows-1256': 0.61; 'between': 0.63; 'url:blogspot': 0.64; 'offer': 0.65; 'lack': 0.71; 'url:11': 0.71; 'subjectcharset:windows-1256': 0.75 X-Originating-IP: [213.130.16.2] From: Andriy Kornatskyy To: "python-list@python.org" Subject: =?windows-1256?Q?duck_typin?= =?windows-1256?Q?g_assert=FE?= Date: Thu, 8 Nov 2012 20:34:58 +0300 Importance: Normal Content-Type: text/plain; charset="windows-1256" Content-Transfer-Encoding: 8bit MIME-Version: 1.0 X-OriginalArrivalTime: 08 Nov 2012 17:34:58.0461 (UTC) FILETIME=[5FB024D0:01CDBDD7] 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352396166 news.xs4all.nl 6894 [2001:888:2000:d::a6]:41339 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32966 People who come from strongly typed languages that offer interfaces often are confused by lack of one in Python. Python, being dynamic typing programming language, 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 Python classes:   http://mindref.blogspot.com/2012/11/python-duck-typing-assert.html   Comments or suggestions are welcome.   Thanks.   Andriy Kornatskyy