| Deutsch English Français Italiano |
|
<definition-20231020125741@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!news-2.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: Where I do ask for a new feature
Date: 20 Oct 2023 11:58:26 GMT
Organization: Stefan Ram
Lines: 25
Expires: 1 Sep 2024 11:59:58 GMT
Message-ID: <definition-20231020125741@ram.dialup.fu-berlin.de>
References: <AQK0UP246oJw6C5qTNAH3VuXX4Gi5QLyHbuRAkCmTDQBb6i7sq5oOQpQ> <CAPTjJmqGRKV0e7NeJAN9xkWUsj8Z0PRZ=JEb1UDya7SDvwLMgg@mail.gmail.com> <708b6c8e-2196-4253-b508-283b4fb58c86n@googlegroups.com> <mailman.0.1697507859.3828.python-list@python.org> <005701da02fc$d094d580$71be8080$@gmail.com> <ae5e080e-1555-4fcb-b626-b67aed452bb9n@googlegroups.com> <mailman.10.1697768785.3828.python-list@python.org> <f835751c-94b8-4b23-80b4-98623642f064n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de uTN6ruljSMkRzeEXtSWMjQ6peSal8knMpVy5GsMD4jpp1G
Cancel-Lock: sha1:bDie5RSzuv52DJZyNm0+RqduVT0= sha256:gjgiEObHZwQKuNKVOFlXMflfNxbpj1bs0YkgjRlP6MQ=
X-Copyright: (C) Copyright 2023 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-1901, en-US, it, fr-FR
Bytes: 2479
Bongo Ferno <bongoferno@gmail.com> writes:
>A with statement makes clear that the alias is an alias and
>is local, and it automatically clears the variable after the
>block code is used.
Python does not seem to have blocks in the way of C and
many other languages.
One could use a "del" to clarify the scope:
tmp = x
x = y
y = tmp
del tmp
. But I believe that the mainstream sees this as bad style.
What comes most close to a block in Python, is a function definition:
def f( ... ):
tmp = ...
. This expresses that the scope of "tmp" is that function definition.