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


Groups > comp.lang.python > #32965

duck typing assert

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 <andriy.kornatskyy@live.com>
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 <andriy.kornatskyy@live.com>
To "python-list@python.org" <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 <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.3454.1352395870.27098.python-list@python.org> (permalink)
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

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:

mindref.blogspot.com/2012/11/python-duck-typing-assert.html

Comments or suggestions are welcome.

Thanks.

Andriy Kornatskyy
 		 	   		  

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


Thread

duck typing assert Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-08 20:30 +0300

csiph-web