Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53721 > unrolled thread
| Started by | jsrig88@gmail.com |
|---|---|
| First post | 2013-09-05 09:40 -0700 |
| Last post | 2013-09-05 10:12 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
Could someone please paraphrase this statement about variables and functions in Python? jsrig88@gmail.com - 2013-09-05 09:40 -0700
Re: Could someone please paraphrase this statement about variables and functions in Python? Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-05 13:05 -0400
Re: Could someone please paraphrase this statement about variables and functions in Python? newspost2012@gmx.de - 2013-09-05 10:12 -0700
| From | jsrig88@gmail.com |
|---|---|
| Date | 2013-09-05 09:40 -0700 |
| Subject | Could someone please paraphrase this statement about variables and functions in Python? |
| Message-ID | <a02c6f75-bbae-4026-aa60-babe011baac4@googlegroups.com> |
Could someone please paraphrase this statement about variables and functions in Python? I am going through the tutorials on docs.python.org, and I came across this excerpt from http://docs.python.org/3/tutorial/controlflow.html: "The execution of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in the local symbol table; whereas variable references first look in the local symbol table, then in the local symbol tables of enclosing functions, then in the global symbol table, and finally in the table of built-in names. Thus, global variables cannot be directly assigned a value within a function (unless named in a global statement), although they may be referenced. "The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is called; thus, arguments are passed using call by value (where the value is always an object reference, not the value of the object). [1] When a function calls another function, a new local symbol table is created for that call." Even as a professional programmer, I'm not really able to follow this. It appears to be self-contradictory, amgiguous, incomplete, and possessive of logical missteps. The problem with looking for this information elsewhere is that it's not going to be all in one spot like this half the time, and it's not going to be readily searchable on Google without more knowledge of what it's referring to. However this looks like something that's too important to overlook. I can tell it's referring to things like scope, pass-by-value, references, probably the call stack, etc., but it is written extremely poorly. Translation please? Thanks!
[toc] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2013-09-05 13:05 -0400 |
| Message-ID | <mailman.99.1378400726.5461.python-list@python.org> |
| In reply to | #53721 |
On Thu, Sep 5, 2013 at 12:40 PM, <jsrig88@gmail.com> wrote: > Could someone please paraphrase this statement about variables and functions in Python? > > I am going through the tutorials on docs.python.org, and I came across this excerpt from http://docs.python.org/3/tutorial/controlflow.html: > > "The execution of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in the local symbol table; whereas variable references first look in the local symbol table, then in the local symbol tables of enclosing functions, then in the global symbol table, and finally in the table of built-in names. Thus, global variables cannot be directly assigned a value within a function (unless named in a global statement), although they may be referenced. > > "The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is called; thus, arguments are passed using call by value (where the value is always an object reference, not the value of the object). [1] When a function calls another function, a new local symbol table is created for that call." > > Even as a professional programmer, I'm not really able to follow this. It appears to be self-contradictory, amgiguous, incomplete, and possessive of logical missteps. The problem with looking for this information elsewhere is that it's not going to be all in one spot like this half the time, and it's not going to be readily searchable on Google without more knowledge of what it's referring to. However this looks like something that's too important to overlook. > > I can tell it's referring to things like scope, pass-by-value, references, probably the call stack, etc., but it is written extremely poorly. Translation please? Thanks! > -- > https://mail.python.org/mailman/listinfo/python-list Nearly everyone gets confused by this initially. You should google python namespaces -- Joel Goldstick http://joelgoldstick.com
[toc] | [prev] | [next] | [standalone]
| From | newspost2012@gmx.de |
|---|---|
| Date | 2013-09-05 10:12 -0700 |
| Message-ID | <e89fe955-89ef-49a1-9a67-f3c9fdd06613@googlegroups.com> |
| In reply to | #53723 |
Am Donnerstag, 5. September 2013 19:05:17 UTC+2 schrieb Joel Goldstick: > On Thu, Sep 5, 2013 at 12:40 PM, <jsrig88@gmail.com> wrote: >> ... >> Even as a professional programmer, I'm not really able to follow this. >> It appears to be self-contradictory, amgiguous, incomplete, and possessive >> of logical missteps. The problem with looking for this information >> elsewhere is that it's not going to be all in one spot like this half the >> time, and it's not going to be readily searchable on Google without more >> knowledge of what it's referring to. However this looks like something >> that's too important to overlook. >> >> I can tell it's referring to things like scope, pass-by-value, references, >> probably the call stack, etc., but it is written extremely poorly. >> Translation please? Thanks! > > Nearly everyone gets confused by this initially. You should google > python namespaces You can also take a look at http://nedbatchelder.com/text/names.html It was a great help for me. Many thanks Ned! - martin -
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web