0

Why create an empty tuple "tp=()" if I can't assign values to it later on? What useful function could I get out of an empty tuple?

1st Aug 2016, 10:56 PM
Mohamed Shoukry
Mohamed Shoukry - avatar
3 Antworten
+ 1
It could be a replacement for None where a tuple is needed.
2nd Aug 2016, 2:19 PM
Ali Rabiee
Ali Rabiee - avatar
0
But can't I assign None where a tuple is needed?
2nd Aug 2016, 5:49 PM
Mohamed Shoukry
Mohamed Shoukry - avatar
0
You could in many situations, but there are some cases that it's more convenient to specify an empty tuple or list -- like as a default value for a function parameter where you expect a tuple.
2nd Aug 2016, 6:14 PM
Ali Rabiee
Ali Rabiee - avatar