use variable name instead of underscore in list comprehension

By convention, in Python we use underscores for "throwaway" variables, for example when unpacking a tuple only a few of whose members we're interested in.
This commit is contained in:
2022-11-02 15:14:51 +01:00
committed by GitHub
parent 5ed8482dcb
commit 4693cf74b2

View File

@@ -48,4 +48,4 @@ def hosts_in_subnet(network: str) -> List[str]:
if not is_subnet(network):
print(f"{network} is not a network")
return [str(_) for _ in ipaddress.ip_network(network).hosts()]
return [str(host) for host in ipaddress.ip_network(network).hosts()]