del_, delete_, and properties

"Mark Hahn" <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
I am in the middle of implementing properties and I have a name dilemna.

The finalizer method name is del_.

The standard property method names were going to be get_, set_, and delete_.
The command to delete an attribute which would cause the delete_ propety
method to execute is del.

Obviously we have a consistency and confusion problem here.  I would like to
make the following changes.

The finalizer method name, which should not be used very often, if at all,
will be finalDel_.

The property method names, which should be used as often as possible, will
be get_, set_, and del_.

Comments?  Votes?

FYI:  The property scheme I am implementing is:

    # normal do-nothing property x
    object Proto1:
            x_ = DEFAULT
            def init_():
                    blah blah blah
            prop x:                     # same as object x(Prop):
                    def get_():
                            return self.x_
                    def set_(val):
                            self.x_ = val
                    def del_(): raise OperationError

obj = Proto1
y = obj.x   #  replaced with:  y = obj.x.get_{obj}()
obj.x = y   #  replaced with:  obj.x.set_{obj}( y )
del obj.x   #  replaced with:  obj.x.del_{obj}()
obj.attrs_['x']          # not replaced
obj.attrs_['x'] = y    # not replaced
del obj.attrs_['x']    # not replaced

    # wild-card properties (like __getattribute__)
    object Proto1:
            def get_():
                    print "you'll get nothing and like it"
            def set_(): pass
            def del_(): pass

p = Proto1()
x = p.anything
you'll get nothing and like it
print x
None
p.asdf = 37
x = p.asdf
you'll get nothing and like it
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.