Deutsch   English   Français   Italiano  
<100quit$a8a5$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!eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.programming
Subject: Re: =?UTF-8?B?4oCcQm9vbGVhbnMgQ29uc2lkZXJlZCBIYXJtZnVs4oCd?=
Date: Fri, 23 May 2025 22:58:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <100quit$a8a5$2@dont-email.me>
References: <100mhh5$3b9hp$3@dont-email.me>
	<160socn9anwy0.10vkreil3u9av.dlg@40tude.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 24 May 2025 00:58:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="6738d3dcc766298d22d18dc5830f0a7e";
	logging-data="336197"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19HyJr1CZEHkzrc3SEvaf80"
User-Agent: Pan/0.162 (Pokrosvk)
Cancel-Lock: sha1:kAfwOtki6HprSZ0jKRwRydjmiaA=
Bytes: 2899

On Fri, 23 May 2025 16:56:55 +0700, JJ wrote:

> I don't think he's a versatile programmer, if he expect every code to be
> self explanatory at any point.

His idea of “self-explanatory” seems to be the limiting factor. No
doubt he would throw up his hands in horror at any mention of De
Morgan’s theorems, for example.

Compare the boolean condition here:

    def colour_samples(self, to_rgb, from_rgb) :
        if (
                not isinstance(to_rgb, (list, tuple))
            or
                not isinstance(from_rgb, (list, tuple))
            or
                len(to_rgb) != len(from_rgb)
            or
                len(to_rgb) % 3 != 0
            or
                len(to_rgb) == 0
        ) :
            raise TypeError("args must be arrays of equal nonzero size, being a multiple of 3")
        #end if
        self.nr_colour_samples = len(to_rgb) // 3
        self._write_stmt("ColorSamples", [conv_num_array.conv(self._parent, to_rgb), conv_num_array.conv(self._parent, from_rgb)], {})
        return \
            self
    #end colour_samples

Would you prefer it written this way?

    def colour_samples(self, to_rgb, from_rgb) :
        if (
                isinstance(to_rgb, (list, tuple))
            and
                isinstance(from_rgb, (list, tuple))
            and
                len(to_rgb) == len(from_rgb)
            and
                len(to_rgb) % 3 == 0
            and
                len(to_rgb) != 0
        ) :
            self.nr_colour_samples = len(to_rgb) // 3
            self._write_stmt("ColorSamples", [conv_num_array.conv(self._parent, to_rgb), conv_num_array.conv(self._parent, from_rgb)], {})
        else :
            raise TypeError("args must be arrays of equal nonzero size, being a multiple of 3")
        #end if
        return \
            self
    #end colour_samples