"Phillip J. Eby" <pje at telecommunity.com> writes: > At 01:39 PM 10/24/03 -0700, Zack Weinberg wrote: >>class foo: >> 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 language! > 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 important. zw
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4