En Wed, 25 Feb 2009 14:50:18 -0200, Shawn Milochik <sh...@milochik.com> escribió:
On Wed, Feb 25, 2009 at 11:38 AM, Marco Mariani <ma...@sferacarta.com> wrote:

Yes it's in Python alright, but it's not Pythonese yet. You could try
avoiding the getter/setter stuff, and camelCase method naming, things like
that, for a start.

What do you mean avoiding the getter/setter stuff? If I understand
correctly, you're saying to directly access the attributes, which I
specifically want to avoid because I may want to enforce some rules
(such as not changing a ship length after it's created).

I think Marco Mariani was suggesting something like this:

class Ship(object):

    def __init__(self, length):
        self._length = length

    def get_length(self):
        return self._length
    length = property(get_length)  # a read only property

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to