"Battleship" style game
Diez B. Roggisch
deets at nospam.web.de
Wed Feb 25 21:15:40 CET 2009
Shawn Milochik schrieb:
> Thanks. I wasn't aware of the property() function, but I read up on
> it. I modified the Vessels.py file, but not the board file (except
> where necessary to handle the changes made to Vessels. Is this better?
Not really. The point about properties is that you *can* make attribute
access trigger getter or setter code.
But not that you do unless there is an actual reason for that. The way
you do it now is simply introducing clutter, without benefit. Your class
would be half the current size - without loss of functionality.
More information about the Python-list