Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

There are no games on this system.


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

SubjectAuthor
o Re: [Python-ideas] Re: New Tool Proposalanthony.flury

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

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: anthony....@btinternet.com (anthony.flury)
Newsgroups: comp.lang.python
Subject: Re: [Python-ideas] Re: New Tool Proposal
Date: Thu, 12 May 2022 07:28:58 +0100
Lines: 63
Message-ID: <mailman.381.1652336948.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>
<acd1cd7f-2664-5ee3-dfb5-d17097dcd6ef@btinternet.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 8m4o/3cRPVbK474S1L8OnwU8s7V1yyI2ELpQ5MEjJHlg==
Return-Path: <anthony.flury@btinternet.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=btinternet.com header.i=@btinternet.com header.b=pHbwM5YX;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'generated': 0.03; 'this:':
0.03; '2022': 0.05; 'class,': 0.05; 'parameter': 0.05; 'pypi':
0.05; 'arrays': 0.07; 'angelico': 0.09; 'blank': 0.09; 'cc:addr
:python-list': 0.09; 'dan': 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; 'instance':
0.16; 'jit': 0.16; 'runtime': 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; 'unable': 0.21; "i've": 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;
'etc': 0.28; 'fact': 0.28; 'header:User-Agent:1': 0.30; 'module':
0.31; 'think': 0.32; 'objects': 0.32; 'received:192.168.1': 0.32;
'but': 0.32; 'there': 0.33; 'able': 0.34; 'header:In-Reply-To:1':
0.34; 'cases': 0.36; 'functions': 0.36; 'subject:ideas': 0.36;
'source': 0.36; 'lists': 0.37; 'using': 0.37; "it's": 0.37;
'received:192.168': 0.37; 'file': 0.38; 'way': 0.38; 'thanks':
0.38; 'two': 0.39; 'single': 0.39; 'handle': 0.39; 'list': 0.39;
'use': 0.39; 'methods': 0.39; 'subject:Proposal': 0.39; 'hand':
0.40; 'received:213': 0.40; 'both': 0.40; 'including': 0.60;
'10,': 0.61; 'email:': 0.63; 'internal': 0.63; 'your': 0.64;
'tool': 0.65; 'required': 0.65; 'numbers': 0.67; 'skip:t 30':
0.67; 'content-type:multipart/mixed': 0.68; 'cost': 0.69;
'types,': 0.69; 'performance': 0.71; 'direct': 0.73; 'little':
0.73; 'relevant': 0.73; 'tools': 0.74; '+44': 0.76; 'major': 0.78;
'anthony': 0.84; 'attribute': 0.84; 'choices': 0.84; 'luck': 0.84;
'skip:u 40': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btinternet.com;
s=btmx201904; t=1652336940;
bh=nW7g4KQYPJQGSj4UvJc4+TUQ7U+ZesT1rq+SZDvXYlI=;
h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To;
b=pHbwM5YXuRUs6JalzV/vsTCgOXJBqiJfYRn34ZBSwox3GsdDwRjcHTBBv5GIlUayoYSaSSjFB411L7G0VJ8QkA/R250YNErcnkqoku4uwbQpVzCngROZAZOfHU1fnAD9Zg0rPwBEmf/heHw4/PdYuqkktwNgtlFvsHhNy5yqpFKfk694ap7Z2IxFbhhA2LfAAljdR9AIFPJA6hBWomUUKaFIG9a8hqQcSu60TnM9dCEivMgozzDMBj+Z2SI4rawJr2Z/py/7tKcZVJfbThpaqDOzE7MfYwTHaz6K1Jf09B4CrOVAptfqbjAyV8upGSdN0F8TU6K9LCCe0iXBm67DOw==
Authentication-Results: btinternet.com;
auth=pass (PLAIN) smtp.auth=anthony.flury@btinternet.com;
bimi=skipped
X-SNCR-Rigid: 613A8CC322E68F69
X-Originating-IP: [81.154.34.124]
X-OWM-Source-IP: 81.154.34.124 (GB)
X-OWM-Env-Sender: anthony.flury@btinternet.com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvfedrgeeigddutdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpegtkfffgggfuffvvehfhfgjsehmtderredtfeejnecuhfhrohhmpedfrghnthhhohhnhidrfhhluhhrhidfuceorghnthhhohhnhidrfhhluhhrhiessghtihhnthgvrhhnvghtrdgtohhmqeenucggtffrrghtthgvrhhnpefhteejieefgeegudeileeijeeufeekvdetleeuffeiteeuhffhgeefkedugefhudenucffohhmrghinhepughnshgrlhhirghsrdhorhhgnecukfhppeekuddrudehgedrfeegrdduvdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurdejiegnpdhinhgvthepkedurdduheegrdefgedruddvgedpmhgrihhlfhhrohhmpegrnhhthhhonhihrdhflhhurhihsegsthhinhhtvghrnhgvthdrtghomhdpnhgspghrtghpthhtohepfedprhgtphhtthhopegurhhsrghlihhsthhssehgmhgrihhlrdgtohhmpdhrtghpthhtohepphihthhhohhnqdhlihhsthesphihthhhohhnrdhorhhgpdhrtghpthhtoheprhhoshhurghvsehgmhgrihhlrdgtohhm
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-SNCR-hdrdom: btinternet.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Content-Language: en-US
In-Reply-To: <CAGGBd_qyrF4rN1HgrVwH9xc4_TKM=j5PtNm6PVqkcUNcN-ngSg@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: <acd1cd7f-2664-5ee3-dfb5-d17097dcd6ef@btinternet.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>
<CAGGBd_qyrF4rN1HgrVwH9xc4_TKM=j5PtNm6PVqkcUNcN-ngSg@mail.gmail.com>
 by: anthony.flury - Thu, 12 May 2022 06:28 UTC

On 10/05/2022 15:04, Dan Stromberg wrote:
>
> 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

Dan,

Thanks for your response, but I think PyPy will have a long way to go to
make JIT generated code more efficient than hand crafted C extension.

for instance PyPy will almost certainly be unable to determine if
integers, floats etc will need to use the Python runtime or can be
optimized to use direct C types, another example would be lists - there
are some cases where the C extension will always be a lot more efficient
using C arrays than using the C list runtime machinery.

While there might be some cases where PyPy will be more efficient, I
don't think that will be the case for all programs, and that ignores the
fact that PyPi has major issues with the CAPI.

> 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
--
Anthony Flury
*Moble*: +44 07743 282707
*Home*: +44 (0)1206 391294
*email*: anthony.flury@btinternet.com

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor