On Thu, 08 Nov 2012 23:44:54 -0500, Terry Reedy wrote:Given the context we were discussing, namely duck-typing, the examples I
> On 11/8/2012 6:40 PM, Steven D'Aprano wrote:
>> IFoo.bar # returns a computed property
> Assuming IFoo is a class and bar is a property attribute of the class,
gave should have been understood as indications, not literal code
snippets. Yes, it is true that "IFoo.bar" returns a property object, and
"Foo.bar" returns an unbound method (a function in Python 3). But they
are meant as illustrations, not working code samples. Much the same way
that we will often talk about "list.append" when what we actually mean is
the bound append method on some specific, context-dependent list instance.
I am sorry that I did not make that clear and that my terminology was
But in context, duck-typing classes normally is intended to substitute an
ifoo = IFoo()
foo = Foo()
In the general case, you cannot use ifoo.bar() where foo.bar() is
Suppose the expected interface is that instance.bar is a method that
integers = [1, 3, ifoo.bar, foo.bar, 42]
So, duck-typing classes IFoo (with bar a property) and Foo (with bar a
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.