Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!zen.net.uk!dedekind.zen.co.uk!reader02.nrc01.news.zen.net.uk.POSTED!not-for-mail From: Nobody Subject: Re: Interface and duck typing woes Date: Thu, 29 Aug 2013 10:41:39 +0100 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.python References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lines: 13 Organization: Zen Internet NNTP-Posting-Host: 1291a079.news.zen.co.uk X-Trace: DXC=P5g\GlFG0m Of course I don't want to check isistance(), I like duck typing, but > should I check if hasattr() and callable() before adding to the container? That won't tell you if the object has a quack() method but with incompatible semantics (e.g. wrong number or types of arguments). > What is the pythonic way to deal with it? Ignore it. If you want early type checking, use a statically-typed language.