newb question about @property
Gregory Ewing
greg.ewing at canterbury.ac.nz
Thu Oct 5 07:29:16 EDT 2017
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
More information about the Python-list
mailing list