Deutsch   English   Français   Italiano  
<uv2upa$42fo$2@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Tue, 9 Apr 2024 08:38:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <uv2upa$42fo$2@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <uudrfg$2cskm$1@dont-email.me>
	<87r0fp8lab.fsf@tudado.org> <uuehdj$2hshe$1@dont-email.me>
	<87wmpg7gpg.fsf@tudado.org> <LISP-20240402085115@ram.dialup.fu-berlin.de>
	<LISP-20240402091729@ram.dialup.fu-berlin.de>
	<wrap-20240402092558@ram.dialup.fu-berlin.de> <uui7hf$3gona$1@dont-email.me>
	<uuj1o5$3pvnq$1@dont-email.me> <87plv6jv1i.fsf@nosuchdomain.example.com>
	<wwv5xwyifq8.fsf@LkoBDZeT.terraraq.uk>
	<if-20240404121825@ram.dialup.fu-berlin.de> <uund4g$ugsb$1@dont-email.me>
	<uuofjh$19pfd$1@dont-email.me> <uuq0fp$1lcgf$2@dont-email.me>
	<86frvzo01i.fsf@williamsburg.bawden.org> <uuq4q9$1mbbf$1@dont-email.me>
	<20240408082037.00002d7c@gmail.com> <uv1q7n$3oohj$1@dont-email.me>
	<20240408155834.00003597@gmail.com> <wwvle5nnfk8.fsf@LkoBDZeT.terraraq.uk>
	<uv2t6t$3o6o$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 09 Apr 2024 08:38:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c62da5eaa27d15bf3b04834dfd3595c9";
	logging-data="133624"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18vbcHGSIo/LTSIDU3kVMsp"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:Km7XM/yNX1bh/dsw56HKsBEwYo8=
Bytes: 3982

On Tue, 9 Apr 2024 10:11:09 +0200, David Brown wrote:

> Comments to say when your loop or functions end is another big red flag 
> that the layout is bad.

Without #end comments: how easy is it to tell which lines belong to
the inner function, and which to the outer?

    def set_message(self, message) :

        w_self = weak_ref(self)

        def wrap_message(c_conn, c_message, c_user_data) :
            self = _wderef(w_self, "vtable")
            conn = Connection(dbus.dbus_connection_ref(c_conn))
            msg = Message(dbus.dbus_message_ref(c_message))
            user_data = conn._user_data.get(c_user_data)
            result = message(conn, msg, user_data)
            if asyncio.iscoroutine(result) :
                self.create_task(result)
                result = DBUS.HANDLER_RESULT_HANDLED
            return \
                result

        if message != None :
            self._wrap_message_func = DBUS.ObjectPathMessageFunction(wrap_message)
        else :
            self._wrap_message_func = None
        self._dbobj.message_function = self._wrap_message_func
        return \
            self

Now, with #end comments (and a #begin as well, for good measure):

    def set_message(self, message) :

        w_self = weak_ref(self)

        def wrap_message(c_conn, c_message, c_user_data) :
            self = _wderef(w_self, "vtable")
            conn = Connection(dbus.dbus_connection_ref(c_conn))
            msg = Message(dbus.dbus_message_ref(c_message))
            user_data = conn._user_data.get(c_user_data)
            result = message(conn, msg, user_data)
            if asyncio.iscoroutine(result) :
                self.create_task(result)
                result = DBUS.HANDLER_RESULT_HANDLED
            #end if
            return \
                result
        #end wrap_message

    #begin set_message
        if message != None :
            self._wrap_message_func = DBUS.ObjectPathMessageFunction(wrap_message)
        else :
            self._wrap_message_func = None
        #end if
        self._dbobj.message_function = self._wrap_message_func
        return \
            self
    #end set_message