Perl vs. Python question...
Paul Lussier
p.lussier at comcast.net
Mon Jul 13 22:59:55 EDT 2009
Lloyd Kvam <python at venix.com> writes:
> You've already gotten two useful responses. I'd just like to add that
> typically, the object attributes are referenced directly:
> rect.length * rect.width
Lloyd, thanks. But what if the attribute isn't set yet? If I have
self.foo, and self.foo hasn't yet been set, I want it to go and get set,
then return the correct value.
I get the impression the __getattr__() method helps here, I just don't
quite get it yet.
--
Thanks,
Paul
More information about the gnhlug-discuss
mailing list