[Python-Dev] Re: closure semantics
zack at codesourcery.com
Fri Oct 24 17:16:27 EDT 2003
"Phillip J. Eby" <pje at telecommunity.com> writes:
> At 01:39 PM 10/24/03 -0700, Zack Weinberg wrote:
>> A = 1 # these are class variables
>> B = 2
>> C = 3
>> def __init__(self):
>> self.a = 4 # these are instance variables
>> self.b = 5
>> self.c = 6
>>I find this imperative syntax for declaring instance variables
>>profoundly unintuitive. Further, on my first exposure to Python, I
>>thought A, B, C were instance variables, although it wasn't hard to
>>understand why they aren't.
> A, B, and C *are* instance variables. Why do you think they aren't?
You prove my point! I got it wrong! This is a confusing part of the
> What good does declaring the set of instance variables *do*? This
> seems to be more of a mental comfort thing than anything else. I've
> spent most of my career in declaration-free languages, though, so I
> really don't understand why people get so emotional about being able
> to declare their variables.
Yeah, it's a mental comfort thing. Mental comfort is important.
Having the computer catch your fallible human mistakes is also
More information about the Python-Dev