Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32966

duck typing assert‏

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 <andriy.kornatskyy@live.com>
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 <andriy.kornatskyy@live.com>
To "python-list@python.org" <python-list@python.org>
Subject duck typing assert‏
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3455.1352396166.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


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 		 	   		  

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

duck typing assert‏ Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-08 20:34 +0300
  Re: duck typing assert‏ Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-08 23:33 +0000
    Re: duck typing assert Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-08 18:00 -0700
      Re: duck typing assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-09 13:36 +0000
        RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 17:01 +0300
        Re: duck typing assert Chris Angelico <rosuav@gmail.com> - 2012-11-10 01:15 +1100
        RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 17:37 +0300
    Re: duck typing assert Chris Angelico <rosuav@gmail.com> - 2012-11-09 17:14 +1100
    RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 13:26 +0300
    RE: duck typing assert "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-09 17:37 +0000
    RE: duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-09 20:55 +0300

csiph-web