+ 3
Why the type of positional argument comes different?
In first case it comes as list and in the second case it comes as tuple https://code.sololearn.com/cgSHi9Z7Mto7/?ref=app
6 Réponses
+ 2
HonFu but how we connect with him?
+ 2
When you unpack a generator to a variable (what you do first with your variable 'd') you create a list (however you cannot 'append' anything to a tupple wich is imutable).
When you append something to a list, you add an item to the end of the actual targeted list... so the list is always a list ^^
When you unpack arguments, python engine know you're another context, and specification have defined that arguments are passed as tuple (because it's logical: there's no need to have a mutable list here).
+ 2
visph i understood thank you😊
You are guru sir😇
+ 1
I doubt there's a deeper meaning. It's probably just how it was defined.
str.split gives list, str.partition gives tuple.
Why? We'll probably have to ask Guido.
+ 1
Guido is the Python creator / guru ;(