Answers for "python mixins"

0

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).
Posted by: Guest on February-08-2022

Python Answers by Framework

Browse Popular Code Answers by Language