A pythonic idiom is to utilize a list comprehension where possible:
def generateHostList(size):
return [ generateHost() for _ in range(size) ]
(notice another idiom of using _
for unused
).
The generateHost
itself may look confusing. The TomBarron's solution is better.
A pythonic idiom is to utilize a list comprehension where possible:
def generateHostList(size):
return [ generateHost() for _ in range(size) ]
(notice another idiom of using _
for unused
).
The generateHost
itself may look confusing. The TomBarron's solution is better.
A pythonic idiom is to utilize a list comprehension where possible:
def generateHostList(size):
return [ generateHost() for _ in range(size) ]
(notice another idiom of using _
for unused
).
The generateHost
itself may look confusing. The TomBarron's solution is better.