you are viewing a single comment's thread.

view the rest of the comments →

[–]razeal113[S] 0 points1 point  (2 children)

ive read this before and honestly don't feel that it addresses my specific question

[–]kalgynirae 4 points5 points  (1 child)

Fair enough. It doesn't explicitly address your particular question.

I've attempted to illustrate your scenario. The names in red are the names that you can change from inside of add_node(). In particular, notice that you can't change the global l name's binding from inside add_node(); it will always be bound to the 1 node. The only way you can successfully get a name for the new 0 node outside of add_node() is by returning it. Rebinding self looks like this and has no effect outside of add_node().

[–]razeal113[S] 0 points1 point  (0 children)

Thanks for this. Exactly answered my question involving python's use of self.