python restart shell_issue 2049: IDLE - Restart Shell & Run Module - Python tracker

Messages (5)

Author: Tal Einat (taleinat) *

日期: 2008-02-08 12:34

When IDLE is run with a subprocess, add a 'Restart Shell & Run Module'

item to the 'Run' menu in editor windows. Also add Alt-F5 as a hotkey

for this item.

This is what the 'Run Module' (F5) item used to do (when there was a

subprocess). As of this patch 'Run Module' will not restart the shell

under any circumstances.

The advantages of this are that the user has more control (can run a

module in the shell either with or without restarting). It also avoids

surprising users which wouldn't expect 'Run Module' to restart the shell.

Based on changes proposed by Doug on idle-dev:

http://mail.python.org/pipermail/idle-dev/2007-January/002541.html

Author: Kurt B. Kaiser (kbk) *

日期: 2008-02-11 02:27

I don't want to complicate the IDLE interface and confuse the users

with an additional decision (or a chording keypress for the normal

state) for this very special case (messing up a connection to a

robot). One of the main features of using the IDLE subprocess is a

clean restart and reload of all code being run.

An alternate approach would be to have a config-main item which if

set (and not settable in the Options Dialog!) would skip the Shell

restart when running code with F5. The user could then hit Ctrl-F6

when he did want a restart.

Author: Tal Einat (taleinat) *

日期: 2008-02-11 11:07

I agree that the interface should be kept as simple as possible, but

this is a meaningful and important addition, which will help clarify to

the users how to work with the subprocess. The point of this change is

avoid surprising the user, while also making the interface more

straightforward and consistent.

The major usage issues that this patch addresses, as I see them, are:

1. New users are surprised and aggravated when they first use 'Run

Module', because they weren't expecting the shell to be restarted,

causing them to lose a lot of work done before the restart. This also

happens to experienced users sometimes (accidents happen) and can be

very frustrating. I don't think the 'normal state' should be to restart

the shell, rather this should always be explicitly requested by the user.

2. When working with a subprocess, there is no (simple) way to just run

the module in the shell without restarting it.

3. Inconsistency in the functionality of 'Run Module' depending on

whether you have a subprocess.

The problem with the configuration option approach is that if you

configure 'Run Module' to not restart, then restarting requires:

switching to the Shell window, restarting, switching back to the editor

window, and running the module: 4 actions instead of one.

Author: Kurt B. Kaiser (kbk) *

日期: 2008-02-11 22:13

I disagree. It's a major feature of the revised IDLE that code is

run

in a fresh environment every time. New users will only be

'surprised'

once, if at all. They will learn to put the creation of the

objects,

etc. that they want to retain into the top level module they are

running. Getting into a discussion of whether to start fresh or

not,

and why, adds more confusion than it eliminates, particularly for

beginners. Also, should this be implemented, if someone were to

accidentally make the wrong choice they are going to be *really*

aggravated!

I would accept a patch for a hidden switch to enable this behavior

for the unique application in question. Maybe even better, a patch

for a normally disabled extension to add the functionality and menu

entries.

Running w/o the subprocess is for 'experts'. It was rather

surprising we were able to continue to do it.

Author: Tal Einat (taleinat) *

日期: 2008-02-11 23:19

First of all, installing Python on Windows creates a 'Edit with IDLE'

context-menu item whenever you right-click a .py file, which opens IDLE

without a subprocess. The reason for this is that there is still a

problem regarding having several instances of IDLE, each with a

subprocess, open in parallel on Windows. The result is that many users

on Windows are often running IDLE without a subprocess; we can't treat

it as an 'expert' mode.

IMHO if you really feel strongly about this, then the Windows issue must

be resolved, and the 'Edit with IDLE' context-menu item should run IDLE

with a subprocess.

I understand your point that having the shell be restarted every time

helps teach good programming practices. But IDLE is used not only as a

learning environment; it's also a great Python shell for other purposes,

such as testing & debugging or scientific uses. I agree that these are

more advanced uses, so perhaps restarting the shell could be the

default, and the option to not have it restarted available when needed.

Thinking about it, I like the idea of an extension which is disabled by

default. I'll think about it some more, and then perhaps implement it.

Just a thought: It would be important to mention such an extension in a

prominent place in the documentation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这段代码是一个 `docker-compose.yml` 文件,用于定义一个多容器的 Docker 应用程序。主要分为三个部分,分别是版本信息、网络信息和服务信息,下面是详细的翻译: ``` version: '3' # 版本号 networks: # 网络配置 likeadmin: # 网络名 driver: bridge # 网络类型 services: # 服务配置 nginx: # nginx服务 container_name: likeadmin-nginx # 容器名 image: nginx:1.23.1 # 容器镜像 restart: always # 容器停止后自动重启 depends_on: # 依赖关系 - "php" # 依赖于php服务 volumes: # 挂载卷 - ../server:/docker_php/server - ./config/nginx/conf.d:/etc/nginx/conf.d - ./log/nginx/logs:/logs networks: # 网络 - likeadmin ports: # 端口绑定 - "80:80" php: # php服务 container_name: likeadmin-php image: likeshop/php:8.0.22-fpm restart: always working_dir: /docker_php/server volumes: - ../server:/docker_php/server networks: - likeadmin ports: - "9000:9000" user: "1000:1000" mysql: # mysql服务 container_name: likeadmin-mysql image: mysql:5.7.29 #X86架构 #image: amd64/mysql:5.7.29 #arm架构 restart: always environment: # 环境变量 MYSQL_ROOT_PASSWORD: root volumes: # 挂载卷 - ./data/mysql5.7.29/lib:/var/lib/mysql - ./config/mysql/mysqld.cnf:/etc/mysql/my.cnf networks: # 网络 - likeadmin ports: # 端口绑定 - "3306:3306" redis: # redis服务 container_name: likeadmin-redis image: redis:7.0.4 restart: always volumes: # 挂载卷 - ./data/redis:/data networks: # 网络 - likeadmin ports: # 端口绑定 - "6379:6379" node: # node服务 container_name: likeadmin-node image: node:14.18.1 restart: always volumes: # 挂载卷 - ../admin:/likeadmin_php/admin networks: # 网络 - likeadmin tty: true working_dir: /likeadmin_php/admin ports: # 端口绑定 - "5173:5173" ``` 这个 `docker-compose.yml` 文件定义了5个服务,分别是 `nginx`、`php`、`mysql`、`redis` 和 `node`,并且它们都在同一个网络 `likeadmin` 中。每个服务都有自己的 `container_name`、`image`、`restart`、`volumes`、`networks` 和 `ports` 等配置信息,其中 `depends_on` 用于定义服务之间的依赖关系。 希望这个翻译能够帮助你更好地理解这个 `docker-compose.yml` 文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值