summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-09-02 13:06:00 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-09-02 13:06:00 (GMT)
commit8315da4c17a0df7bc86e27dc5eb9308d5c3272ff (patch)
tree49fd79d7219d578555caa7eb5fe7088dee45f927
parent31a0a1478bbaabbd166a694023b7f93f0f0f2563 (diff)
downloadcpython-8315da4c17a0df7bc86e27dc5eb9308d5c3272ff.zip
cpython-8315da4c17a0df7bc86e27dc5eb9308d5c3272ff.tar.gz
cpython-8315da4c17a0df7bc86e27dc5eb9308d5c3272ff.tar.bz2
Clarify example; add imports
-rw-r--r--Doc/whatsnew/2.6.rst14
1 files changed, 10 insertions, 4 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 7f85bf7..bf50500 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -1224,7 +1224,7 @@ do it where it's absolutely necessary.
You can write your own ABCs by using ``abc.ABCMeta`` as the
metaclass in a class definition::
- from abc import ABCMeta
+ from abc import ABCMeta, abstractmethod
class Drawable():
__metaclass__ = ABCMeta
@@ -1256,15 +1256,21 @@ exception for classes that don't define the method.
Note that the exception is only raised when you actually
try to create an instance of a subclass lacking the method::
- >>> s=Square()
+ >>> class Circle(Drawable):
+ ... pass
+ ...
+ >>> c=Circle()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
- TypeError: Can't instantiate abstract class Square with abstract methods draw
+ TypeError: Can't instantiate abstract class Circle with abstract methods draw
>>>
Abstract data attributes can be declared using the
``@abstractproperty`` decorator::
+ from abc import abstractproperty
+ ...
+
@abstractproperty
def readonly(self):
return self._x
@@ -3206,5 +3212,5 @@ Acknowledgements
The author would like to thank the following people for offering suggestions,
corrections and assistance with various drafts of this article:
-Georg Brandl, Nick Coghlan, Jim Jewett, Antoine Pitrou.
+Georg Brandl, Steve Brown, Nick Coghlan, Jim Jewett, Antoine Pitrou.