Re: duck typing assert

2012-11-12 Thread Ian Kelly
On Fri, Nov 9, 2012 at 6:36 AM, Steven D'Aprano wrote: > (I think... I really don't actually know if Zooey Deschanel can sing or > not. Just go along with the example.) Not only does she sing, she's in a band. http://en.wikipedia.org/wiki/She_%26_Him I take your point about the "looks like" ter

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
...@live.com; python-list@python.org > Subject: RE: duck typing assert > Date: Fri, 9 Nov 2012 17:37:29 + > > Andriy Kornatskyy wrote: > > > > Thank you for all comments. > > > > > It makes very good sense to say: > > > > > > duckmatch(IFoo

RE: duck typing assert

2012-11-09 Thread Prasad, Ramit
Andriy Kornatskyy wrote: > > Thank you for all comments. > > > It makes very good sense to say: > > > > duckmatch(IFoo).compare(Foo) > > Since we do duck match of IFoo... but there is no `duck match`, there is > `duck test`. I believe instead of > `compare` is more readable with `equals`. Than

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
Nov 2012 01:15:36 +1100 > Subject: Re: duck typing assert > From: ros...@gmail.com > To: python-list@python.org > > On Sat, Nov 10, 2012 at 1:01 AM, Andriy Kornatskyy > wrote: > > > > 1. In looks-like we check features of Foo (that may be superset) of what > > IFoo

Re: duck typing assert

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 1:01 AM, Andriy Kornatskyy wrote: > > 1. In looks-like we check features of Foo (that may be superset) of what IFoo > offers. > > assert looks(Foo).like(IFoo) > > 2. We can check if Foo is limited to IFoo only: > > assert looks(IFoo).like(Foo) > > So it valid to have both

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: duck typing assert > Date: Fri, 9 Nov 2012 13:36:39 + > To: python-list@python.org > > On Thu, 08 Nov 2012 18:00:58 -0700, Ian Kelly wrote: > > > On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano >

Re: duck typing assert

2012-11-09 Thread Steven D'Aprano
On Thu, 08 Nov 2012 18:00:58 -0700, Ian Kelly wrote: > On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano > wrote: >> On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote: >> >>> People who come from strongly typed languages that offer interfaces >>> often are confused by lack of one in Pytho

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
Foo).like(IFoo) assert looks(IFoo).like(Foo) Thanks. Andriy Kornatskyy -------- > Date: Fri, 9 Nov 2012 17:14:49 +1100 > Subject: Re: duck typing assert > From: ros...@gmail.com > To: python-list@python.org > > On Fri, Nov 9, 2012 at 12:00 PM, Ian Kelly wrote:

Re: duck typing assert

2012-11-08 Thread Chris Angelico
On Fri, Nov 9, 2012 at 12:00 PM, Ian Kelly wrote: > looks(Foo).like(IFoo), on the other hand, is crystal clear about which > argument is which. I'm not so sure that it is, tbh. If you read it like an English sentence, it's clearly testing whether Foo matches the template in IFoo, but which are yo

Re: duck typing assert

2012-11-08 Thread Ian Kelly
On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano wrote: > On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote: > >> 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, follo

RE: duck typing assert

2012-11-08 Thread Andriy Kornatskyy
.ke...@gmail.com > Date: Thu, 8 Nov 2012 11:34:45 -0700 > Subject: Re: duck typing assert > To: python-list@python.org > > On Thu, Nov 8, 2012 at 10:30 AM, Andriy Kornatskyy > wrote: > > > > People who come from strongly typed languages that offer interfaces often >

Re: duck typing assert

2012-11-08 Thread Ian Kelly
On Thu, Nov 8, 2012 at 10:30 AM, Andriy Kornatskyy wrote: > > 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: > > asser

duck typing assert

2012-11-08 Thread Andriy Kornatskyy
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 asse