[Twisted-Python] doc/core/howto/components.xhtml question

Lee Harr missive at hotmail.com
Fri Oct 29 00:17:59 EDT 2004


in doc/core/howto/components.xhtml there is a
HairDryer class like this:


class HairDryer:
    def plug(self, socket):
        adapted = IAmericanSocket(socket)
        assert socket.voltage() == 110, "BOOM"
        print "I was plugged in properly and am operating"


I am new to this interface / adaptation system,
but I am thinking it should be:

class HairDryer:
    def plug(self, socket):
        adapted = IAmericanSocket(socket)
        assert adapted.voltage() == 110, "BOOM"
        print "I was plugged in properly and am operating"


If so...

Index: doc/core/howto/components.xhtml
===================================================================
--- doc/core/howto/components.xhtml     (revision 12146)
+++ doc/core/howto/components.xhtml     (working copy)
@@ -338,7 +338,7 @@
class HairDryer:
     def plug(self, socket):
         adapted = IAmericanSocket(socket)
-        assert socket.voltage() == 110, "BOOM"
+        assert adapted.voltage() == 110, "BOOM"
         print "I was plugged in properly and am operating"
</pre>

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.com/





More information about the Twisted-Python mailing list