0

What is placeholder variables

14th Sep 2018, 4:59 PM
Asma Sohail
Asma Sohail - avatar
2 Respuestas
+ 6
Variables with intentionally meaningless names, like foo, bar or _ (an underscore sign). Used mostly for technical reasons - as an iterator or an assignment of unneeded part of a method return value.
14th Sep 2018, 7:39 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
What Kuba said. An example might be making a list of all the vowels in a string: my_string = "Hello World!" vowel_list = [foo for foo in my_string if foo in "aeiou"] print(vowel_list) # output: ["e", "o", "o"]
15th Sep 2018, 4:17 AM
David Ashton
David Ashton - avatar