Home | Contents | Latest | Previous | Next

Python ABCs

From: "andrew cooke" <andrew@...>

Date: Sat, 31 May 2008 09:34:38 -0400 (CLT)

ABCs are "Abstract Base Classes" and are a way of describing interfaces
while keeping some kind of "duck typing".  They're described at
http://www.python.org/dev/peps/pep-3119/

However, they don't seem that useful at first - the most obvious use for
them that I could see was to write unit tests that verify types (although
they are more complex than I first thought - see all the details in the
link above).

Things become much clearer, once you realise that Python will have
optional typing.  See
http://www.artima.com/weblogs/viewpost.jsp?thread=89161 - then it's easy
to see how the ABCs will be used in type constraints.

Andrew

Comment on this post