metasyntactic-variable

What is the origin of foo and bar? [closed]

人盡茶涼 提交于 2019-12-28 01:38:27
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Closed 6 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. Where did they come from and when were they first used? 回答1: tl;dr "Foo" and "bar" as metasyntactic variables were popularised by MIT and DEC, the first references are in work on LISP and PDP-1 and Project MAC

To foo bar, or not to foo bar: that is the question

大城市里の小女人 提交于 2019-12-20 16:22:54
问题 This was something originally discussed during a presentation given by Charles Brian Quinn of the Big Nerd Ranch at acts_as_conference. He was discussing what he had learned from instructing a Ruby on Rails Bootcamp to many people both new to programming and new to Rails. One particular slide that stood out was along the lines of never using foo and bar as examples when trying to teach someone to program . His reasoning was very simple. Which is easier to understand? baz = foo + bar or answer

Meaning of foo, bar, baz, etc

北城余情 提交于 2019-12-19 19:58:56
问题 I've always wanted to know what the foo, bar, baz, etc... names mean. Several times I've found these terms in scientific articles. Furthermore this terminology in some way serves as a standard for other exemplifications. Does anyone know where these terms come from, and how to use them properly? 回答1: While this question borders on being outside the scope of Stack Overflow, I highly recommend the Wikipedia article on the matter: The History of Foobar To give a quick preview: The word foo

What is the purpose of the single underscore “_” variable in Python?

情到浓时终转凉″ 提交于 2019-12-11 17:41:36
问题 What is the meaning of _ after for in this code? if tbh.bag: n = 0 for _ in tbh.bag.atom_set(): n += 1 回答1: _ has 4 main conventional uses in Python: To hold the result of the last executed expression(/statement) in an interactive interpreter session. This precedent was set by the standard CPython interpreter, and other interpreters have followed suit For translation lookup in i18n (see the gettext documentation for example), as in code like: raise forms.ValidationError(_("Please enter a

To foo bar, or not to foo bar: that is the question

不打扰是莪最后的温柔 提交于 2019-12-03 04:24:01
This was something originally discussed during a presentation given by Charles Brian Quinn of the Big Nerd Ranch at acts_as_conference . He was discussing what he had learned from instructing a Ruby on Rails Bootcamp to many people both new to programming and new to Rails. One particular slide that stood out was along the lines of never using foo and bar as examples when trying to teach someone to program . His reasoning was very simple. Which is easier to understand? baz = foo + bar or answer = first_number + second_number It's happened many times myself when explaining something and I

Python underscore as a function parameter

丶灬走出姿态 提交于 2019-11-30 06:13:47
I have a python specific question. What does a single underscore _ as a parameter means? I have a function calling hexdump(_) . The _ was never defined, so I guess it has some special value, I could not find a reference telling me what it means on the net. I would be happy if you could tell me. In Python shells, the underscore ( _ ) means the result of the last evaluated expression in the shell: >>> 2+3 5 >>> _ 5 There's also _2 , _3 and so on in IPython but not in the original Python interpreter. It has no special meaning in Python source code as far as I know, so I guess it is defined

Python underscore as a function parameter

試著忘記壹切 提交于 2019-11-29 06:37:26
问题 I have a python specific question. What does a single underscore _ as a parameter means? I have a function calling hexdump(_) . The _ was never defined, so I guess it has some special value, I could not find a reference telling me what it means on the net. I would be happy if you could tell me. 回答1: In Python shells, the underscore ( _ ) means the result of the last evaluated expression in the shell: >>> 2+3 5 >>> _ 5 There's also _2 , _3 and so on in IPython but not in the original Python

What is the origin of foo and bar? [closed]

人盡茶涼 提交于 2019-11-26 21:13:53
Where did they come from and when were they first used? Hugo tl;dr "Foo" and "bar" as metasyntactic variables were popularised by MIT and DEC, the first references are in work on LISP and PDP-1 and Project MAC from 1964 onwards. Many of these people were in MIT's Tech Model Railroad Club, where we find the first documented use of "foo" in tech circles in 1959 (and a variant in 1958). Both "foo" and "bar" (and even "baz") were well known in popular culture, especially from Smokey Stover and Pogo comics, which will have been read by many TMRC members. Also, it seems likely the military FUBAR

Underscore _ as variable name in Python [duplicate]

非 Y 不嫁゛ 提交于 2019-11-26 03:52:02
问题 This question already has an answer here: What is the purpose of the single underscore “_” variable in Python? 5 answers Peter Norvig has an essay describing a program to solve sudoku puzzles, even the hardest ones, by combining deterministic logical operations and smart traversal of the possible solutions. The latter is done recursively; here\'s that function (source): def search(values): \"Using depth-first search and propagation, try all possible values.\" if values is False: return False

What is the purpose of the single underscore “_” variable in Python?

馋奶兔 提交于 2019-11-25 22:14:42
问题 What is the meaning of _ after for in this code? if tbh.bag: n = 0 for _ in tbh.bag.atom_set(): n += 1 回答1: _ has 4 main conventional uses in Python: To hold the result of the last executed expression(/statement) in an interactive interpreter session. This precedent was set by the standard CPython interpreter, and other interpreters have followed suit For translation lookup in i18n (see the gettext documentation for example), as in code like: raise forms.ValidationError(_("Please enter a