Ugh. I met your type. Single-letter variable names. No documentation. Because typing more would consume too much time. No thank you.
Edit: Not you, particularly. But I have met bad typists, and that is how many of them behaved. Don't be that guy.
Edit: Not you, particularly. But I have met bad typists, and that is how many of them behaved. Don't be that guy.
I can't touch type but my code reads:
def snmp_command(session, oid, media_servers):
result = list()
for host_name in media_servers:
snmp = SNMP_CMD.format(host=host_name, oid=oid)
snmp_reply = [x for x in session.cmditer(snmp)]
if len(snmp_reply) == 0:
log.warning("No data for EMS Media Server SNMP cmd {0} for host {1}".format(snmp, host_name))
continue
# add the Media Server host from which we got this reply to the list of snmp reply
snmp_reply.append(host_name)
result.append(snmp_reply)
return resultThat said, where's your docstring? Why are your lines longer than 80 chars? Why is your indent 2 chars instead of 4? What does `oid` mean? http://legacy.python.org/dev/peps/pep-0008/