Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The Shuttle is now going five times the sound of speed. -- Dan Rather, first landing of Columbia


devel / comp.lang.python / Re: REPL with multiple function definitions

SubjectAuthor
o Re: REPL with multiple function definitionsRoel Schroeven

1
Re: REPL with multiple function definitions

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: roel@roelschroeven.net (Roel Schroeven)
Newsgroups: comp.lang.python
Subject: Re: REPL with multiple function definitions
Date: Mon, 27 Jun 2022 00:37:55 +0200
Lines: 38
Message-ID: <mailman.724.1656283079.20749.python-list@python.org>
References: <f877d2ae-f24f-b56e-b335-ac446988b5b0@btinternet.com>
<d53e34e8-3474-1464-69f3-103ded853b61@roelschroeven.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de Y1yygwiGMvWdqdBN5zgIYgh1ZGqdJpBDT9t1Xg7eJ4yA==
Return-Path: <roel@roelschroeven.net>
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=roelschroeven.net header.i=@roelschroeven.net
header.b=GExMlixP; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.018
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'def': 0.04; 'indicate':
0.05; 'construct': 0.09; 'prints': 0.09; 'prompt,': 0.09;
'url:stable': 0.09; 'syntax': 0.15; 'construct.': 0.16;
'constructs.': 0.16; 'ipython': 0.16; 'planet': 0.16;
'received:10.202': 0.16; 'received:10.202.2': 0.16;
'received:internal': 0.16; 'received:messagingengine.com': 0.16;
'schreef': 0.16; 'syntaxerror:': 0.16; 'python': 0.16; 'to:addr
:python-list': 0.20; 'machine': 0.22; 'bit': 0.27; 'function':
0.27; '>>>': 0.28; 'this?': 0.29; 'header:User-Agent:1': 0.30;
'program': 0.31; '"",': 0.32; 'amounts': 0.32; 'empty': 0.32;
'python-list': 0.32; 'there': 0.33; 'same': 0.34; 'requires':
0.34; 'header:In-Reply-To:1': 0.34; 'invalid': 0.35; 'runs': 0.35;
'url-ip:104.17/16': 0.35; 'url:)': 0.35; 'received:66': 0.35;
'file': 0.38; 'means': 0.38; 'thanks': 0.38; 'use': 0.39;
'prompt': 0.39; 'should': 0.40; 'ever': 0.63; 'everything': 0.63;
'pass': 0.64; 'yourself': 0.75; 'life': 0.77; 'extra': 0.84;
'(such': 0.84; 'remind': 0.84; 'rob': 0.84; 'film': 0.91;
'organic': 0.91; 'earth': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
roelschroeven.net; h=cc:content-transfer-encoding:content-type
:date:date:from:from:in-reply-to:in-reply-to:message-id
:mime-version:references:reply-to:sender:subject:subject:to:to;
s=fm1; t=1656283077; x=1656369477; bh=em+sUGenCmh+uk4hwpjWVZG/o
+oAvpBPVLZWTRDohk0=; b=GExMlixPJuDJPnATq/ET+DO+TGL+lFxhOJTtWDp7W
etcSg3X75eqE9cLxFL+TpCCfP/Z18hFTp8sji4OSTM0uhGbQPU44H5nddsIPT1ux
7exuEartN8qFs+ry1nCc/wtYNLhrJTt1MfcArWoqjd7WEqHhE/T2E4CTluyDBXuY
mgwov82Dy0nWsxte9DpRC/aWOhNep4Jwvu+aUQIBMp84JbMB2d02unf3te5awJ19
k6ziUwR07N3f05qZQdwOmxR1aKp8WLdEQY7HjRbzaI5eiOMvFIlhNfT/NhHYMPen
2LT0M1up6qYObLltOO4hm2tJ6D2t4jiXbk0yOiiFiV41w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-transfer-encoding:content-type
:date:date:feedback-id:feedback-id:from:from:in-reply-to
:in-reply-to:message-id:mime-version:references:reply-to:sender
:subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender
:x-me-sender:x-sasl-enc; s=fm2; t=1656283077; x=1656369477; bh=e
m+sUGenCmh+uk4hwpjWVZG/o+oAvpBPVLZWTRDohk0=; b=NhIZwG9J0xue6YzTh
q5fL/RU+CRW9h4TCZMt3fr86jm+t87x5iwvo1ZinH27un+FWKijgCVT7d2RGqvx1
i/BZTdB9aAKeTWNyFz4zS458XL7vQZ/ou5PdmaEyPFoNiT956n+9frapFZ/0woFR
r7UX5pnz2kiMh4Ds4fbf3o+C110DCzM8xI1H32yI9fuBg8UyR93hHdZAI5AGfFW5
3n+hfPWqLXJ8auRG1zBBAjwbrAeO0iVlJJgQwON8t0XxQZqUePVKieaVbR4u2YQR
hPLBDMUAmAPylHMhXAJBwPpQWZ/YMNYh8hJtOOJ0VjHF8fZFfjXEhOgHiXZJDU43
jShJg==
X-ME-Sender: <xms:xN-4YiqsYXP0dMdhnOSSh7yAgRGpl6qkhh4GULiRgA6wzSZVRkIPYg>
<xme:xN-4Ygom8kvCnMRU7xavbQKxJDdx5nOZVjA7NIBCQd0zNZauJza-MOo1N1G_essc1
VryBMjNuBmh>
X-ME-Received: <xmr:xN-4YnOG35hGZt7i0CUrfDeLdgLg-eAyCHmUzzHX8azmB8jiNF3KpefzKwwn7_NZEuGXIKGeN9Oag-PtGiN-yGiKZLnfiKk>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeggedgtdejucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtke
ertddtfeejnecuhfhrohhmpeftohgvlhcuufgthhhrohgvvhgvnhcuoehrohgvlhesrhho
vghlshgthhhrohgvvhgvnhdrnhgvtheqnecuggftrfgrthhtvghrnhepieeludfgvdehte
ekveevffefjeegudehjeekueekveeggeejveekgfehiefgtdfhnecuffhomhgrihhnpehr
vggrughthhgvughotghsrdhiohenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh
epmhgrihhlfhhrohhmpehrohgvlhesrhhovghlshgthhhrohgvvhgvnhdrnhgvth
X-ME-Proxy: <xmx:xN-4Yh793trKKXKnOhcHB-HJ03Rvk_WL_25zf9NIBtpUslSiKCBaPw>
<xmx:xN-4Yh5-RiA3ko-HNhxf1HanXhW-tp_OBdLpd059fD0__VDwn8UJzw>
<xmx:xN-4YhhD4ds39FgGwWuLEhVhKzyeIQDaC4N92YybKlO2tQHGR57IAg>
<xmx:xd-4YiVQDVVTGzEAvijeSECh76pjHS9odbfpbkl_jVTFctI6fJZmAw>
Feedback-ID: i8e5b41ae:Fastmail
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Content-Language: nl
In-Reply-To: <f877d2ae-f24f-b56e-b335-ac446988b5b0@btinternet.com>
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: <d53e34e8-3474-1464-69f3-103ded853b61@roelschroeven.net>
X-Mailman-Original-References: <f877d2ae-f24f-b56e-b335-ac446988b5b0@btinternet.com>
 by: Roel Schroeven - Sun, 26 Jun 2022 22:37 UTC

Rob Cliffe via Python-list schreef op 27/06/2022 om 0:14:
> This 2-line program
>
> def f(): pass
> def g(): pass
>
> runs silently (no Exception).  But:
>
> 23:07:02 c:\>python
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> def f(): pass
> ... def g(): pass
>   File "<stdin>", line 2
>     def g(): pass
>     ^
> SyntaxError: invalid syntax
> >>>
>
> Is there a good reason for this?
The REPL requires an extra empty line to indicate the end of multi-line
constructs. You can see it by the prompt: as long as the REPL prints
'... '  as prompt, that means it puts everything you type in the same
multi-line construct. To enter a new multi-line construct (such as a
function definition, a for-loop, an if-statement, ...), press enter
directly at the prompt; the REPL should than use '>>> ' as the prompt again.

(Alternatives like IPython (https://ipython.readthedocs.io/en/stable/)
are a bit more loose regarding how to enter multi-line constructs)

--
"Iceland is the place you go to remind yourself that planet Earth is a
machine... and that all organic life that has ever existed amounts to a greasy
film that has survived on the exterior of that machine thanks to furious
improvisation."
-- Sam Hughes, Ra


devel / comp.lang.python / Re: REPL with multiple function definitions

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor