Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vaises$2k7o6$2@dont-email.me>
Deutsch   English   Français   Italiano  
<vaises$2k7o6$2@dont-email.me>

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

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!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: Python (was Re: I did not inhale)
Date: Mon, 26 Aug 2024 21:35:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 88
Message-ID: <vaises$2k7o6$2@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <uvbfii$3mom0$1@news.xmission.com>
	<20240412094809.811@kylheku.com> <87il0mm94y.fsf@tudado.org>
	<way-20240413091747@ram.dialup.fu-berlin.de> <87il0lldf8.fsf@tudado.org>
	<choices-20240413123957@ram.dialup.fu-berlin.de>
	<v9lm2k$12qhv$1@dont-email.me> <v9m4gd$14scu$1@dont-email.me>
	<20240815182717.189@kylheku.com> <v9npls$1fjus$1@dont-email.me>
	<v9t204$2dofg$1@dont-email.me> <va28pi$3dldm$1@dont-email.me>
	<va2ro9$3gd7v$1@dont-email.me> <va2vt0$3h3gj$1@dont-email.me>
	<va44rh$3p1l6$1@dont-email.me> <va45eq$3pkt9$1@dont-email.me>
	<va4aut$3q4g0$1@dont-email.me> <va4fbr$3qvij$1@dont-email.me>
	<va5108$3tmmd$1@dont-email.me> <va51ok$3tqr9$1@dont-email.me>
	<va5ec2$3vluh$1@dont-email.me> <va6q4g$c1a7$1@dont-email.me>
	<va6rpa$c6bg$1@dont-email.me> <va6se9$cb8e$1@dont-email.me>
	<20240826083330.00004760@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 26 Aug 2024 23:35:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="eec8a5f8880ec9ebcfea2c2354da2438";
	logging-data="2760454"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+ZRbzyw2cXndbPNqq3tAyX"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:id8UsdPl0bUtBLEtPlWfr1OaUtk=
Bytes: 4923

On Mon, 26 Aug 2024 08:33:30 -0700, John Ames wrote:

> ... the simple fact that Guido & co. made a boneheaded choice like that
> is the reason I'll never be able to *respect* it, even when I do find
> myself using it.

I restore the redundancy by using “#end” comments. E.g. a seriously
nontrivial case:

    def def_struct_class(name, ctname, extra = None) :
        # defines a class with attributes that are a straightforward mapping
        # of a ctypes struct. Optionally includes extra members from extra
        # if specified.

        ctstruct = getattr(CAIRO, ctname)

        class result_class :

            __slots__ = tuple(field[0] for field in ctstruct._fields_) # to forestall typos

            def to_cairo(self) :
                "returns a Cairo representation of the structure."
                result = ctstruct()
                for name, cttype in ctstruct._fields_ :
                    setattr(result, name, getattr(self, name))
                #end for
                return \
                    result
            #end to_cairo

            @classmethod
            def from_cairo(celf, r) :
                "decodes the Cairo representation of the structure."
                result = celf()
                for name, cttype in ctstruct._fields_ :
                    setattr(result, name, getattr(r, name))
                #end for
                return \
                    result
            #end from_cairo

            def __getitem__(self, i) :
                "allows the object to be coerced to a tuple."
                return \
                    getattr(self, ctstruct._fields_[i][0])
            #end __getitem__

            def __repr__(self) :
                return \
                    (
                        "%s(%s)"
                    %
                        (
                            name,
                            ", ".join
                              (
                                "%s = %s" % (field[0], getattr(self, field[0]))
                                for field in ctstruct._fields_
                              ),
                        )
                    )
            #end __repr__

        #end result_class

    #begin def_struct_class
        result_class.__name__ = name
        result_class.__doc__ = \
            (
                "representation of a Cairo %s structure. Fields are %s."
                "\nCreate by decoding the Cairo form with the from_cairo method;"
                " convert an instance to Cairo form with the to_cairo method."
            %
                (
                    ctname,
                    ", ".join(f[0] for f in ctstruct._fields_),
                )
            )
        if extra != None :
            for attr in dir(extra) :
                if not attr.startswith("__") :
                    setattr(result_class, attr, getattr(extra, attr))
                #end if
            #end for
        #end if
        return \
            result_class
    #end def_struct_class