steve at holdenweb.com
Sat Sep 3 08:05:13 CEST 2005
LeRoy Lee wrote:
> I have been searching for the answer to this as it will determine how I use
> classes. Here are two bits of code.
[snip already well-quoted examples]
> I can't figure out why it is working this way. I figure I must be thinking
> about this wrong. I was thinking that I could bind attributes to the class
> from within methods using the self prefix. According to this example I can
> only when passing other info into the init. Is there a rule that I am just
> not aware off? Am I totally off base (I am not real experienced)? What is
> the self prefix for then if not to bind up the tree?
You are clearly Doing Something Wrong (tm), as I and a number of other
experienced Python programmers don't see the problems you are seeing. Is
it possible that you didn't cut-and-paste those examples, but instead
retypes them, and in so doing accidentally corrected your error in the
posting you made to the group?
You seem to understand how classes should (and do) work, so it was
probably a PICNIC error :-)
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list