Questions tagged [name-binding]
33 questions
0
votes
0 answers
python trie implementation - global reference changing when function runs
I'm trying to implement a trie in python. This is my class:
class Node(object):
children = {}
data = 0
def __init__(self):
for char in letters:
self.children[char] = None
Then I created a simple function to add a…

Matheus Jun Ota
- 21
- 5
0
votes
0 answers
Does JS have name binding operations?
I'm a newbie to js. Let me illustrate my question with a few examples.
Code 1
var temp = { key: "value" };
var data = ["v1", "v2"];
var result = [];
for (var i in data) {
var newdata = temp; /** Note here! **/
newdata.key = data[i];
…

JavaNoScript
- 2,345
- 21
- 27
0
votes
2 answers
Why does the function name inside a named function in JavaScript no longer refer to the function itself?
Consider the following named function:
function f() {
return f.apply(this, arguments);
}
If you call this function normally it would result in a stack overflow as expected. Not very interesting. So let's do some magic:
var g = f, f =…

Aadit M Shah
- 72,912
- 30
- 168
- 299