[Python-ideas] collections.abc.Stream

Steven D'Aprano steve at pearwood.info
Sat Jun 18 08:18:43 EDT 2016


On Sat, Jun 18, 2016 at 11:47:12AM +0000, Bar Harel wrote:
> >
> > This is the fundamental idea behind duck typing - you only need to
> > implement the methods needed by the code you're calling.
> >
> 
> But then again, the problem is that you don't know what methods are needed
> by the code.

It is the responsiblity of the code to document what it needs. It can 
document that it needs an int or a str, or an object with a read() 
method.


-- 
Steve


More information about the Python-ideas mailing list