osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

newb question about @property


bartc wrote:
> Result? You can't just look at my 'any' class and see what fields it 
> uses. You can't even just look at the static source code. You have to 
> run the program to find out. And it might be different each time.

You can usually get a pretty good idea of what attributes a
class has by looking at its definition. The vast majority of
classes will either initialise their attributes in the __init__
method or provide defaults as class variables.

While in theory it's possible for code to add attributes
later after initialisation, in practice this is hardly ever
done.

-- 
Greg