I have following code from wesley chun's core python application programming book
#!/usr/bin/env python
"""
tcp server
"""
from socket import AF_INET, SOCK_STREAM, socket
from time import ctime
HOST = ''
PORT = 21567
BUFSIZE = 1024
ADDR = (HOST, PORT)
tcp_server_socket = socket(AF_INET, SOCK_STREAM)
tcp_server_socket.bind(ADDR)
#maximum number of incoming connection before connection is refused
tcp_server_socket.listen(5)
while True:
print "waiting for connection"
tcpCliSock, addr = tcp_server_socket.accept()
print "... connected from:" , addr
while True:
DATA = tcpCliSock.recv(BUFSIZE)
if not DATA:
break
tcpCliSock.send('[%s] %s' % (ctime(), DATA))
tcpCliSock.close()
tcp_server_socket.close()
I did some modifications to the original code however I am still confused how best to modify it to be more compliant
here are all the messages I am getting
C: 14,0: Invalid name "tcp_server_socket" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 21,4: Invalid name "tcpCliSock" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 21,16: Invalid name "addr" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
E: 25,15: Instance of '_socketobject' has no 'recv' member
E: 28,8: Instance of '_socketobject' has no 'send' member
I suppose first three just want me to use all caps variable names, is that the standard practice for these type of scripts, I don't see the code becoming more readable by using this convention, on the contrary it will look less readable, what are the motivation behind such rule in pylint and how to make code more compliant, I hardly think writer of such stature would write code like this without reason, be it readablity, beginner friendliness or anything else.