Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

It's ten o'clock; do you know where your processes are?


devel / comp.lang.python / Re: [Python-ideas] Re: New Tool Proposal

SubjectAuthor
o Re: [Python-ideas] Re: New Tool ProposalDan Stromberg

1
Re: [Python-ideas] Re: New Tool Proposal

<mailman.369.1652191505.20749.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18220&group=comp.lang.python#18220

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: drsali...@gmail.com (Dan Stromberg)
Newsgroups: comp.lang.python
Subject: Re: [Python-ideas] Re: New Tool Proposal
Date: Tue, 10 May 2022 07:04:51 -0700
Lines: 37
Message-ID: <mailman.369.1652191505.20749.python-list@python.org>
References: <d21aa51c-f85e-7b10-da54-856fee603af8@btinternet.com>
<CAPTjJmr0s_CyaUgS=H9dZNKKkRgDtKxyLhNmUw54RLNw_DFf0A@mail.gmail.com>
<6a16e4f8-b1d7-292e-60d2-1db611456c2f@btinternet.com>
<CAPTjJmqUqL7S-RcOAOHFpjaC35F5Yqz94c83KizbOZFeKXpgHw@mail.gmail.com>
<CAGGBd_qyrF4rN1HgrVwH9xc4_TKM=j5PtNm6PVqkcUNcN-ngSg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de HEw8eU29/fGZbsyDlgb0bwF/J23pCQDHMNis1Z2CeZdQ==
Return-Path: <drsalists@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=otPKqh3o;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'this:': 0.03; '2022':
0.05; 'class,': 0.05; 'parameter': 0.05; 'angelico': 0.09;
'blank': 0.09; 'cc:addr:python-list': 0.09; 'float': 0.09;
'identical': 0.09; 'int': 0.09; 'subject:Python': 0.12; '&gt;':
0.14; 'boilerplate': 0.16; 'cc:name:python list': 0.16; 'cython.':
0.16; 'from:addr:drsalists': 0.16; 'from:name:dan stromberg':
0.16; 'instance': 0.16; 'sensible': 0.16; 'structures': 0.16;
'tracebacks': 0.16; 'wrote:': 0.16; 'python': 0.16; 'developer':
0.16; 'probably': 0.17; 'uses': 0.19; 'tue,': 0.19;
'cc:addr:python.org': 0.20; 'subject:: [': 0.21; 'subject:] ':
0.21; "i've": 0.22; 'way.': 0.22; 'code': 0.23; 'lines': 0.23;
'idea': 0.24; 'examples': 0.25; 'extension': 0.25; 'cc:2**0':
0.25; 'classes': 0.26; 'project.': 0.27; 'chris': 0.28; 'module':
0.31; 'objects': 0.32; 'message-id:@mail.gmail.com': 0.32; 'but':
0.32; 'able': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'functions': 0.36; 'subject:ideas': 0.36; 'source': 0.36; 'using':
0.37; "it's": 0.37; 'received:209.85': 0.37; 'file': 0.38;
'received:209': 0.39; 'two': 0.39; 'single': 0.39; 'handle': 0.39;
'use': 0.39; 'methods': 0.39; 'subject:Proposal': 0.39; 'both':
0.40; 'including': 0.60; '10,': 0.61; 'internal': 0.63; 'tool':
0.65; 'required': 0.65; 'numbers': 0.67; 'cost': 0.69; 'types,':
0.69; 'performance': 0.71; 'little': 0.73; 'relevant': 0.73;
'tools': 0.74; 'attribute': 0.84; 'choices': 0.84; 'luck': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=74ncfNXHuZYZLW7TuiU8+yfp8RL9PzzsZNR4q9/9hOs=;
b=otPKqh3oVHc4V73iFP4o3aawyPbWuwDtYQklyvZVhSL5MyZ2cPkQeZXBUOSt5Jba6w
sTpY/teUIZaR1zHqoeugMSzhPjQ/EMh/mNWtIumTx5o6DCC5pKLxsPiX20nDp4vVAhVm
YYW401QRxDzG37FcbjNKCHVtpDCYrR4xaAFYM+F3SKU1+dtSzSyGOEddppnrg/5pXSnQ
+EK8j1cRt+nq+PwW6fwJG3osJfytjAYWPyH/W08zDlaC/Ks19hkTzy7nsZeLVEJaD9fO
elUNUdHulehu+4u4HHTcXgq03fy9fzH7VIIxlxlKhXIVxGWAX+aA2W0/ZLO26OS2Xx0B
JR3Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=74ncfNXHuZYZLW7TuiU8+yfp8RL9PzzsZNR4q9/9hOs=;
b=d7WtEp1ELZkjsNlTvPQrlwgPhTvbsABOLc49+nAyFjPoJl4fU+N+I763L4MdBfYh2o
QzA8M3c2xEfWMij9SNpY90UUZWlb4QzErnorCwWXOSJ6WspfkQfxKacRq6ZFO3tW9Ir8
h6MT3JwF1pw4UmLtMPiB4fGYxP5yuaXLYhazyGcGruWkfcih1VEn7xVwHTmNL9VHDY6+
XeDsavnb4F/lUyDCwDvl2/8fIvPVheaPo7zJ15wUVeqW8wdu6RtUy/MQDgJOZZ/Fua1M
1IPizlJvCgAR5EgOSBZNpfEj5jOgRDaApxUVloxJtPRFZC6wQr2gr+YGGh5HVx3/50Nq
usRA==
X-Gm-Message-State: AOAM532it84PsBUCGvDEwVKJo6eJzREeS7AgbZgB0emdK9CzY1awJBH+
tTx3k8pYTNYx1QONqAMtR2uCX64pF4bUAqfoeJo=
X-Google-Smtp-Source: ABdhPJxwQHCXrIlfpMui0luYodWBjmA/VkN7OENxLW+WEImRulHvIPs4hZHicIQGEO1vCvjXRPXRP9c2LXzQ/t2w93o=
X-Received: by 2002:a1f:c148:0:b0:34d:9a00:d469 with SMTP id
r69-20020a1fc148000000b0034d9a00d469mr11767920vkf.13.1652191503096; Tue, 10
May 2022 07:05:03 -0700 (PDT)
In-Reply-To: <CAPTjJmqUqL7S-RcOAOHFpjaC35F5Yqz94c83KizbOZFeKXpgHw@mail.gmail.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAGGBd_qyrF4rN1HgrVwH9xc4_TKM=j5PtNm6PVqkcUNcN-ngSg@mail.gmail.com>
X-Mailman-Original-References: <d21aa51c-f85e-7b10-da54-856fee603af8@btinternet.com>
<CAPTjJmr0s_CyaUgS=H9dZNKKkRgDtKxyLhNmUw54RLNw_DFf0A@mail.gmail.com>
<6a16e4f8-b1d7-292e-60d2-1db611456c2f@btinternet.com>
<CAPTjJmqUqL7S-RcOAOHFpjaC35F5Yqz94c83KizbOZFeKXpgHw@mail.gmail.com>
 by: Dan Stromberg - Tue, 10 May 2022 14:04 UTC

On Tue, May 10, 2022 at 3:15 AM Chris Angelico <rosuav@gmail.com> wrote:

> > It is often the case that developer write Code in Python and then
> convert to a C extension module for performance regions.
> >
> > A C extension module has a lot of boiler plate code - for instance the
> Structures required for each class, the functions for Module initialization
> etc.
> >
> > My Idea is a simple tool that uses introspection tools to take a Python
> module and to generate the relevant boiler plate for the module - including
> blank functions for the module classes and for methods. This tool would use
> type annotations (if given) to make sensible choices for parameter and
> attribute types, including using int and float directly rather than
> Internal objects (depending on tool options).
>

Two things to say about this:
1) Sometimes abandoning a pure python module for a C extension for
performance is a mistake - because Pypy is probably going to be much faster
with the pure python module
2) I've had some luck using m4 to maintain a single source file that is
used to automatically generate both pure python and cython. This is a
little like using cpp in a C project.

For examples of #2, perhaps see:
https://stromberg.dnsalias.org/~strombrg/treap/
https://stromberg.dnsalias.org/svn/rolling_checksum_mod/trunk/
https://stromberg.dnsalias.org/~strombrg/sort-comparison/

It's often nice to keep the lines of the pure-python and cython having a
1-1 relationship, so that tracebacks report useful line numbers either
way. However, in the treap example I've dispensed with that because some
methods were almost identical but had some boilerplate - and m4 was able to
handle that nicely at the cost of lines being 1-1.

HTH

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor