Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Sex, Drugs & Linux Rules -- MaDsen Wikholm, mwikholm@at8.abo.fi


devel / comp.lang.python / How make your module substitute a python stdlib module.

SubjectAuthor
* How make your module substitute a python stdlib module.Antoon Pardon
`- Re: How make your module substitute a python stdlib module.Stefan Ram

1
How make your module substitute a python stdlib module.

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: antoon.pardon@vub.be (Antoon Pardon)
Newsgroups: comp.lang.python
Subject: How make your module substitute a python stdlib module.
Date: Tue, 27 Dec 2022 11:27:29 +0100
Lines: 11
Message-ID: <mailman.1306.1672136854.20444.python-list@python.org>
References: <9ac8fb4f-b998-e7cd-6499-e3427e42e420@vub.be>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 3AiP74f4M60pK679LO8LGAwV6e/aKFL0ckHPsWcxlDDA==
Return-Path: <Antoon.Pardon@vub.be>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=vub.be header.i=@vub.be header.b=KxfVln7B; dkim-adsp=pass;
dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'thread': 0.05;
'subject:python': 0.06; 'modules': 0.07; 'subject:module': 0.07;
'module.': 0.09; 'ok,': 0.09; 'log': 0.12; 'antoon': 0.16;
'from:addr:antoon.pardon': 0.16; 'from:addr:vub.be': 0.16;
'from:name:antoon pardon': 0.16; 'instance': 0.16; 'message-
id:@vub.be': 0.16; 'pardon': 0.16;
'received:eur01-he1-obe.outbound.protection.outlook.com': 0.16;
'subject:module.': 0.16; 'threading': 0.16; 'instead': 0.17;
'name.': 0.19; 'to:addr:python-list': 0.20; 'subject:How': 0.23;
'library': 0.26; 'function': 0.27; 'header:User-Agent:1': 0.30;
'module': 0.31; 'there': 0.33; 'subject:your': 0.83;
'received:eurprd01.prod.exchangelabs.com': 0.84; 'subject:make':
0.84
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=hZKajBuUUg/3WRRQQgORO+9tlIXDxsraSiRAMSG/OeaxY0WDO+KR9FjF+F4T98ok5XAQbSzi42vZb0y8/FnRUNf65eMyA48zAeJmax48pQATPfcwlRskL0xvROnwSIqvaBVvxQ0oBZq0FbEW0hXOZmBJCXBvvKKb9Ny9PLrXhUY+h+1vQjf06MYQ9t4hZ4DJSf2JwR/x1n49OVsjc2royzaht2iEcRDnPWGLm+Xb/U1pw7KbW/a1bANxvVlH7nbVbSvzo985wUBezEQHm0+C7ssk0bQzMHVL99CG3AyX1e4C8X2QCt5U7GUkBdt+dQjQSaKt6LTwxqOu4Fn8ssjtbw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=ELRiBqRxg64KGomSDVcNGuItAeOFD/lLRK9r02AiE2A=;
b=Qrke4qblEEkuMujVlV0C0xEOT5Kr9PIcIOC5uYkc8MuDvde+Rw7sSWtnyHk/LfQaIWnvwOJw2tfBg+zVJ5vhXX/sFd5lAm5Z8lS2cdj+B65ydCOVzlIqsJzBqT1DDR8ge0LHZVNz0lamsUYlNvUzU6iylDIjvoZLcVH5u6E7XYiwkiW3g2y+YErtDiYz5L1/VRm1YsqSC1j4aiItQoWfXWO6fNMksr/qHESnsiGoX2DTOuTdDzwZx9EoWeAIVv5gZpuvu7pb4PmTHHHxJUoOoJetkpxzOxymFQKUECp5WVNYFj9J1f7iJvxYfz+QTj5NlwvhhJsB7dk9Xk+F/nTrPQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=vub.be; dmarc=pass action=none header.from=vub.be; dkim=pass
header.d=vub.be; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vub.be; s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=ELRiBqRxg64KGomSDVcNGuItAeOFD/lLRK9r02AiE2A=;
b=KxfVln7Bz3nBzlYTVADOOR3CvE2ZiPvhaNdzMJJrHVuyvyNKVRqzIEUm4hDnVi4Z4hQyVGUlwaFQWopX25Uh0lNCCZEYpNrNX8ILbCgLPdMWgV5IDTLcncS/MlkJYLNI06e689eYYb50ayvCszPAHWAm+wE2+FdnnuyWphlPrEY=
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=vub.be;
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Content-Language: nl-BE
X-ClientProxiedBy: AS4P192CA0017.EURP192.PROD.OUTLOOK.COM
(2603:10a6:20b:5e1::12) To AM0PR01MB4147.eurprd01.prod.exchangelabs.com
(2603:10a6:208:6a::12)
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM0PR01MB4147:EE_|PA4PR01MB9139:EE_
X-MS-Office365-Filtering-Correlation-Id: a6698074-ed3b-4bb1-e4a9-08dae7f4f554
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: VgA757mckbB0WT/HeQx52m5w1IuqUQxF5/JpEZ+3NY2ZStF4PlXLa1ulAmU08fwG2QhemZ7RBbznnLV9YnviB4at8ZVNFY8/mvCyqoBUUkfKsUkQ3TGeVGZhGpnY56ITyYCPsmU8WlG60xpAmTao+sCjbif0oo6zeQKFdK6SsgZt3NoyR92W914k8CRoBLV1/Qx1WjcsV7W331b5qnlSNwzMwY43IEfYAC+gHvltqP8gFg3gyfAeGRKiVfVz+ZofbwBHj/NJBc5n3aHM+Cmt+dC1Sf7jaSX1O6EzTD9In0C4iwN5ED4du0AbPEUQRc/2kzqcTLLvMnoWZLYJHyxiCINTboWtRXAxtDlOC8EYey0dPbBdCCuMjsDvIm7jLXuokTmLam/B1J+xHaym9mrzWFAG/c9I17JQiY0493HUBjxpoSRB4SANcqAqcQSM40Wx1/+A7+muZSPvp9DdjbBf0SkKXITYgvWlPY5Dppvb5oUrAnb0K1hYn/wFMFjgLqmEZl7BQ2sV4CAownpvSPr/4nuSciM2LJ+CR5o3PS8BwfN3oysLKilB1PbZ96/OxBwzHvQ85XQUvOGUQw8ErxJvWzYkFrxpuyACMOcWXUjODB7Bvwso2WhUGRzn/KufLmmvd6HoRwj8uihJTH69L448qqSRpGeiUhklDiBTVDuDPl1mjinaBO1PHaRv8N1Udgl4
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:AM0PR01MB4147.eurprd01.prod.exchangelabs.com; PTR:;
CAT:NONE;
SFS:(13230022)(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199015)(4744005)(2906002)(44832011)(8936002)(8676002)(66946007)(66476007)(66556008)(41300700001)(6916009)(786003)(316002)(478600001)(186003)(6512007)(6506007)(2616005)(36756003)(6486002)(38100700002)(5660300002)(31686004)(31696002)(86362001)(41320700001)(43740500002);
DIR:OUT; SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: LP0SMwlmgLnoGxx86qqryfegeISmmFnU7h8r5w0cLR7pE
kLyN88A4wVW2aFxap61es+YiOH9NH2lzAxoqFV+7AbUAd
huqp72AamPXN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Yj9W3RR
hXqOfsGBxV4PLP9rfZShGt4jwfnNnTN7hUD6mux4HT4DZ
yZBQg5zlfHsJcsgwRtggtJjf90kNZdpa4o3fAqFU6yMH3
nB/wTlr05J7shCDVBzOvLB+Akp0nOdMk6pPm5Dc46w0+3
sI3mV4kmsUoa81chtLJlFR8Efh3v2pgONXscHmac+CwxL
mZqMecW52IpnkkUHvwqr8rXhf0JwDJCIzF6dwsLsciAEy
y7RjDw8jY7aKzDfptJrLqLDl8u38wyf9ZV+/5C+9CnvS4
fww0Y17mcbzDe8E94IaQ5VBRr5/mqOxCwfnYpAWKrcP8/
0jKbN98nQwECDCG023glyWizdtkk8rAzBVpiCbEb7FuJ9
l7BV3X/C/Fm4EMV+yKYgDq8QF4Krd7VdDvIhRubQ9Eno6
/ECzHOrAbwEy5IT3ZYQCiaxE3FlzuxLUpNU3gwp6+9a5h
HLg/SF7ypzWnFNLI8wyVh9yMQ/66nPgOp1UXPH2G55Cy
X-OriginatorOrg: vub.be
X-MS-Exchange-CrossTenant-Network-Message-Id: a6698074-ed3b-4bb1-e4a9-08dae7f4f554
X-MS-Exchange-CrossTenant-AuthSource: AM0PR01MB4147.eurprd01.prod.exchangelabs.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2022 10:27:30.8020 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 695b7ca8-2da8-4545-a2da-42d03784e585
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: WFF/5jgrLfY1y2FwoznYNynT2JyhlKxgz1l1oIwf4Tb61DNeGJ8DmGhgHdt6GnfnqZmqiVha6Bxw/rkoVr385w==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR01MB9139
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: <9ac8fb4f-b998-e7cd-6499-e3427e42e420@vub.be>
 by: Antoon Pardon - Tue, 27 Dec 2022 10:27 UTC

OK, I am writing an alternative for the threading module. What I would
like to know is how I can get some library modules call my alternative
instead of the threading module.

For instance there is the logging module, it can log the thread name. So
I would like to know how I can get the logging module to call the
function from my module to get the current_thread, instead of it calling
"current_thread" from the threading module.

--
Antoon Pardon

Re: How make your module substitute a python stdlib module.

<alternative-20221227121303@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: How make your module substitute a python stdlib module.
Date: 27 Dec 2022 11:14:17 GMT
Organization: Stefan Ram
Lines: 31
Expires: 1 Dec 2023 11:59:58 GMT
Message-ID: <alternative-20221227121303@ram.dialup.fu-berlin.de>
References: <mailman.1306.1672136854.20444.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 4K/SWwf7HfMRTvokY0Jxjgkw6UH/w3Wtb2jJA/Cdn90BDN
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Tue, 27 Dec 2022 11:14 UTC

Antoon Pardon <antoon.pardon@vub.be> writes: What I would
>like to know is how I can get some library modules call my alternative
>instead of the threading module.

What works here:

module0.py

import math

def f():
print( math.pi )

main.py

import module0

class x:
pi = 3

module0.math = x

module0.f()

output

3

May not work if the module is not directly implemented in Python.


devel / comp.lang.python / How make your module substitute a python stdlib module.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor