Assignment to None
- by Joel
Hello,
I have a function which returns 3 numbers, e.g.:
def numbers():
return 1,2,3
usually I call this function to receive all three returned numbers e.g.:
a,b,c=numbers()
However, I have one case in which I only need the first returned number.
I tried using:
a, None None = numbers()
But I receive "SyntaxError: assignment to None".
I know, of course, that i can use the first option I mentioned and then not use "b" and "c", but only "a". However, this seems like a "waste" of two vars and feels like wrong programming.
Any ideas?
Thanks,
Joek