Certain Python builtins, such as any and all, require an iterable argument. A common pattern I encounter with these is that I chain creating the iterable with the function call. For example:
locations = ["foo", "bar", "baz"]
if any(["city" in location for location in locations]):
print("Locations includes a city")
Is there any benefit to doing this with a tuple instead...
locations = ["foo", "bar", "baz"]
if any(("city" in location for location in locations)):
print("Locations includes a city")
...in terms of memory usage or execution time?