Confusion About Classes

flamesrock flamesrock at gmail.com
Wed Dec 29 20:39:39 EST 2004


Thanks for the responses! And sorry for the late reply, I had to force
myself away from the computer for a day.

M.E.Farmer,
Yes I've been having a little bit of trouble with name spaces, but this
self thing is actually starting to make sense the more I think about it
-- I hadn't thought too much about multiple instances of the same class
for this particular program. The notion of storing data that way makes
better sense with that example. Coming from a background in the more
'procedural' languages it was harder to grasp but I think I'm beginning
to naturally absorb the concept by working my head around these
examples

And thanks for the links :) I know this is going to be full of bugs,
but it would be nice to avoid the more serious ones.

Steven Bethard,
First, thanks for fixing up my class. I really appreciate it.

>Where should score_domain, score_servername and score_port be coming
from?
>Are they the same as the 'domain', 'servername' and 'httpport'
parameters to __init__?
whoops..heh.. my mistake.
My original-confused- idea was to use different variable names because
I didn't want the function to interfere with the classes variables
directly as I'd be passing the objects variables to itself..if that
makes any sense. Your way makes me wonder how the heck I came to my
logifc in the first place

>As an aside, there's probably no need to prefix your variables with
>double-underscores -- this causes name mangling that's generally not
>necessary in a "we're all consenting adults" language like Python.
Ahh..from an example on the net, I though it was a necessary thing for
the interpreter..heh. Well not having to certainly simplifies things
-thanks




More information about the Python-list mailing list