Chris Angelico at 2015/12/27 UTC+8 2:32:32PM wrote:
> On Sun, Dec 27, 2015 at 3:11 PM, wrote:
> > Last night I noticed that Python does not resolve name in "def" during
> > import, as C does in the compile/link stage, it was deferred until it was
> > referenced (i.e. codes was executed). That'
On Sun, Dec 27, 2015 at 3:11 PM, wrote:
> Last night I noticed that Python does not resolve name in "def" during
> import, as C does in the compile/link stage, it was deferred until it was
> referenced (i.e. codes was executed). That's OK for Anyway codes has to be
> debugged sooner or later.
On Sun, Dec 27, 2015 at 3:05 PM, wrote:
>> Python's flexibility and simplicity are a huge part of why I love the
>> language so much.
>
> simplicity? Maybe because you are s familiar with Python. It's not to me,
> at least at this moment. Please see my next question follows.
>
I define "sim
Last night I noticed that Python does not resolve name in "def" during import,
as C does in the compile/link stage, it was deferred until it was referenced
(i.e. codes was executed). That's OK for Anyway codes has to be debugged sooner
or later. I just have to get used to this style.
But check
Chris Angelico at 2015/12/26 UTC+8 5:50:07PM wrote:
> 11: Another normal assignment, because otherwise the rest of the work
> is pointless. :)
Thanks for this detailed example. As I had learned so far, Python really take
"name" seriously, and every meaningful result you got have to assign to a n
On Sat, Dec 26, 2015 at 8:07 PM, wrote:
> Thank you for the explanation. It reminds me to dig out something which seems
> I had been read before. It's about nested scope in the book "Learning Python"
> by Mark Lutz.
>
> "An assignment (X = value) creates or changes the name X in the current lo
jf...@ms4.hinet.net writes:
> Thank you, Ben. It's amazing that you seem to know every piece of
> Python information hiding in the web:-)
You're welcome, I'm glad to help. As for the “hiding”, the answer is in
the Python documentation itself.
> see this question listed in python core language's
Chris Angelico at 2015/12/26 UTC+8 11:44:21AM wrote:
> Pike is semantically very similar to Python, but it uses C-like
> variable scoping. Here's an equivalent, which might help with
> comprehension:
>
> function outerf()
> {
> int counter = 55;
> void innerf()
> {
> write("%d
Ben Finney at 2015/12/26 UTC+8 11:42:08AM wrote:
> The Python FAQ answers this, even using an example the same as yours
> https://docs.python.org/3/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value>.
>
Thank you, Ben. It's amazing that you seem to know every
On Sat, Dec 26, 2015 at 2:06 PM, wrote:
> As a tranditional language programmer like me, the result is really weird.
By "traditional", I'm guessing you mean that you know C-like languages
(Java, ECMAScript/JavaScript, etc). In C, and in many languages
derived from or inspired by it, variable sco
jf...@ms4.hinet.net writes:
> In the first situation, the local variable 'counter' can be referenced
> correctly. But in the second, why a statement added after the print()
> statement can makes this variable "disappear", even the print() won't
> do the right thing. Isn't it wired? please help!
T
11 matches
Mail list logo