Trying to understand Python objects
George Sakkis
george.sakkis at gmail.com
Tue Nov 21 20:20:34 EST 2006
James Stroud wrote:
> walterbyrd wrote:
> > Reading "Think Like a Computer Scientist" I am not sure I understand
> > the way it describes the way objects work with Python.
> >
> > 1) Can attributes can added just anywhere? I create an object called
> > point, then I can add attributes any time, and at any place in the
> > program?
>
> Not all objects behave this way. For example, incidences of the object
> class:
>
> (snipped)
>
> > Then attributes are added at some other time?
>
> Yes. This goes for old (clasobj) and new style classes.
>
> (snipped)
>
>I think this flexibility is part the python philosophy, but I am not a python
> philosopher (nor was I meant to be).
Neither a python tutor, apparently, but strong candidate for the
monthly "most confusing-to-a-newbie reply" award.
George
More information about the Python-list
mailing list