21. Ignoring unpacked values from a tuple
Try not to create that extra variable declaration when unpacking tuples. Use the underscore _ to ignore declaring a variable when unpacking a tuple.
21.1. Don’t do this
1def get_info():
2 return 'John', 'Doe', 28
3
4fname, lname, tmp = get_info()
5
6print(fname, lname)
21.2. Do this
1def get_info():
2 return 'John', 'Doe', 28
3
4fname, lname, _ = get_info()
5
6print(fname, lname)