Class Friends
Alex Martelli
aleaxit at yahoo.com
Fri Aug 27 14:37:43 EDT 2004
Sean Don <a at c.d> wrote:
> Hello!
>
> Is it possible to make classes friends in Python? Or is it better to just
stick
> to "Java style" .isThis, .getThat, .setThis style functions?
Neither. "friends" has no possible meaning in Python terms. Accessor
methods are a horrid idea in Python: if you ever need access to an
attribute to trigger the execution of some code, why, use 'property' --
that's what it's THERE for!
> I understand that classes are generally grouped logically into separate
files
> anyway. So, this isn't always necessary. But I'm a perfectionist and was
> wondering if friendships were possible in Python.
What could 'friendship' possibly ever MEAN in a Python context...?!
Alex
More information about the Python-list
mailing list