0
What is metasyntactic variable ? I m confushed. Use some example .thnkx
7 Réponses
+ 3
Example:
If you have an object foo of type bar, then type(foo) will return <class 'bar'>.
foo and bar, in this case metasyntactic variables, are just placeholders. If foo is [1,2] then bar is list. Plug that into the sentence above, and you know type([1,2]) is <class 'list'>.
+ 2
Do you mean metasyntactic?
+ 2
Variables. Take the sentence
2*x is the same as x+x.
Here x is a variable, where you can plug in numbers. If x=5, the sentence reads
2*5 is the same as 5+5.
foo and bar are also variables, but now you do not plug in numbers, but python objects. Note that they are not variables in the python language, but in the language we use to talk about the python language, a meta-language if you will. Hence the name metasyntactic variables.
+ 2
I would not call a python variable a metasyntactic variable, because it is part of the language itself.
0
yes.
0
i cant get it. what is foo and bar .?
0
then may i call all variables as a metasyntactic variables ?