Trying to understand Python objects

walterbyrd walterbyrd at iname.com
Tue Nov 21 18:03:57 EST 2006


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?

2) Are classes typically created like this:

class Point:
  pass

Then attributes are added at some other time?

3) What is with the __underscores__ ??

4) Are parameters passed to an class definition?

class Whatever(params):
   pass

I sort-of understand the way objects work with PHP. With PHP, the
classes are defined in one place - sort of like a function. To me, that
makes more sense.




More information about the Python-list mailing list