0
What do we mean by metasyntactic variable?
for eg the variables foo and bar what do they mean by saying that these variables are placeholders
1 Respuesta
+ 3
It is part of the naming convention or rather naming style. Normally, you name your variables so that they mean something. This way, particularly if you are consistent, the code is logical and you don't have to scan it all to know what a given variable represents somewhere inside the program.
However, there might be cases where you need just a variable with no particular meaning - this may be an iterator of a for loop for example - most often 'i' or 'x' and such. I even saw several codes where there was a method returning a two-tuple and since only its first element was needed, the assignment used an underline as the second one:
a, _ = function_returning_a_2_tuple()
That indicated that this second variable is not important, it just has to be there as a placeholder for the method not to raise an exception.
I think similar case is with foo and bar. They do not have any particular meaning apart from their usual, low-importance indication :)