Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Protozoa are small, and bacteria are small, but viruses are smaller than the both put together."


devel / comp.lang.python / Re: sharing data across Examples docstrings

SubjectAuthor
o Re: sharing data across Examples docstringsChris Angelico

1
Re: sharing data across Examples docstrings

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: sharing data across Examples docstrings
Date: Wed, 12 Jan 2022 09:17:03 +1100
Lines: 20
Message-ID: <mailman.159.1641939437.3079.python-list@python.org>
References: <87v8ypgc0a.fsf@phoca.sebkatja.org>
<CAPTjJmrws0tGHWoQVrPPZtTjzD1XLW0Q8W7f+47rf49eO8cgQA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 7HlV+cY6l5W9whgqvszSMwaYabkkR0tuPZ8+hCzelLiw==
Return-Path: <rosuav@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=CY0J0i6C;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.022
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '2022': 0.05; 'searching':
0.05; 'class.': 0.07; 'mechanism': 0.09; 'chrisa': 0.16;
'easiest': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris
angelico': 0.16; 'received:209.85.221.42': 0.16; 'received:mail-
wr1-f42.google.com': 0.16; 'subject:sharing': 0.16; 'wrote:':
0.16; 'probably': 0.17; 'to:addr:python-list': 0.20; "i'd": 0.24;
'actual': 0.25; 'examples': 0.25; 'seems': 0.26; 'function': 0.27;
'modified': 0.32; 'message-id:@mail.gmail.com': 0.32; 'but': 0.32;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'trying': 0.35; 'from:addr:gmail.com': 0.35; 'received:209.85':
0.37; 'class': 0.37; 'way': 0.38; 'received:209': 0.39; 'wed,':
0.39; 'hello,': 0.40; 'sharing': 0.60; 'method': 0.61; "you'd":
0.64; 'your': 0.64; 'exactly': 0.68; 'within': 0.69; 'form.':
0.91; 'well...': 0.91; 'will.': 0.91
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;
bh=FgA3+oYy2mqHnSYTRc168p57S67cZIIvK5vk33rl3sQ=;
b=CY0J0i6CsEHwHCoT6DnrgdbkUXvWZxVpzNuRCvx4risqjr+NEgqDkm07zEI/I3UR/9
b3BYhlKGlDyGIcsohw+qulKQVWZdK85iRYHAIEBTFYSOvg8eynRCXouMMRJyFKpcjaWV
6e8x8yZe4HxdQSahv1lrlozV+WS4XAyvvodx6RoRTjSNZROI9csPJydJ6jBu7U4//4kr
lPxOJVMF8tl7EMfz4mhd1FJrKjmUPOjeq+ksL2MZmmhvf83G3i7g9dwEkuJCpOgiR4P/
ZLkyjZr1H7Z3oqX+ufOmhr9Lgacz7ClzrUCVqfTPF/4TgCuyVZeCVZIwWCGuLpDcTOzz
RYhw==
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;
bh=FgA3+oYy2mqHnSYTRc168p57S67cZIIvK5vk33rl3sQ=;
b=asGQnlsCu440QlHvjGljEj8i+yL3tqu++0yM6Jz3xB5qYm10zxU4R/wjRgDKgcD/on
dIl8I1nXbMzkHuL3wpEZ0NUfDflo9R+P8WWnHsz5h27YTedPJB+/ArO6nT+I1zKQqkw5
DSy9KR2RsZvOqopVOHJIJs7NQL+M71cnrYbETBWgfY2fkjs3jr8bL8G7ZAKyQPf4Yban
bD+nsZTCVCcPIOO3wuu34Y1cyl5Xu/DHesNcI+7NZUSKU2nR0MV3djy9gIj71O0glbHf
m9vnJyYMLEg74QyCeSCehvJrnzSzcmP/R1qzmTV7tndniVCsVaL7dRMcohmFjUZ8Cz9o
zXEA==
X-Gm-Message-State: AOAM532jSELVkRr1sRrr7vzTdYAqgAUGKOuk11m/eg6BRSmlGCuHVdQI
IOe73KzpKTZk7m65j3hwpNDeESvh72tgStHe5IU9wWsH
X-Google-Smtp-Source: ABdhPJw0ZMgmBvBPLhi7i27gYI9ZkSPqzKKVDhUA5Wf/3X8TMyJez8mcgkm8XGfs/M7cuGDQKLE7rqccWuL+n/+6BD8=
X-Received: by 2002:a05:6000:156c:: with SMTP id
12mr5414747wrz.104.1641939435285;
Tue, 11 Jan 2022 14:17:15 -0800 (PST)
In-Reply-To: <87v8ypgc0a.fsf@phoca.sebkatja.org>
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: <CAPTjJmrws0tGHWoQVrPPZtTjzD1XLW0Q8W7f+47rf49eO8cgQA@mail.gmail.com>
X-Mailman-Original-References: <87v8ypgc0a.fsf@phoca.sebkatja.org>
 by: Chris Angelico - Tue, 11 Jan 2022 22:17 UTC

On Wed, Jan 12, 2022 at 9:11 AM Sebastian Luque <spluque@gmail.com> wrote:
>
> Hello,
>
> I am searching for a mechanism for sharing data across Examples sections
> in docstrings within a class. For instance:

This seems like trying to cram too much information into the
docstring, but oh well... do what you will.

I'd recommend a decorator. The easiest way would probably be to have a
placeholder of some sort in the actual docstring, and in the
decorator, you replace __doc__ with the modified form.

To do what you're asking for, your decorator would either need to go
through every method in the class and mutate its docstring (in which
case you'd decorate the class), or mutate the docstring of exactly one
function (in which case you'd decorate that method).

ChrisA

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor