Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python mixins

A mixin can also be viewed as an interface with implemented methods.
example below is a TCP server with added features:

class ThreadingTCPServer(ThreadingMixIn, TCPServer):
    pass
	
1. the ThreadingMixIn class adds functionality to the ThreadingTCPServer (a TCP server)	
1a. i.e. without having to duplicate the code in ThreadingMixIn
2. ThreadingMixIn provide alternative underlying functionality without affecting the functionality from TCPServer (i.e. as a socket server).
 
Source by en.wikipedia.org #
 
PREVIOUS NEXT
Tagged: #python #mixins
ADD COMMENT
Topic
Name
4+2 =