Re: Are there any easy-to-use Visual Studio C# WinForms-like GUI designers in the Python world for Tk?

2023-12-29 Thread Jach Feng via Python-list
Félix An 在 2023年12月29日 星期五下午2:05:24 [UTC+13] 的信中寫道: > I'm used to C# WinForms, which has an easy-to-use drag-and-drop GUI > designer in Visual Studio. Is there anything similar for Tk? How about > Qt? What do you recommend as the easiest way to create GUI programs in > Python, similar to the eas

Re: Windows Gui Frontend

2023-04-03 Thread Jach Feng
Jim Schwartz 在 2023年4月1日 星期六晚上8:00:19 [UTC+8] 的信中寫道: > I have another question. I have an app written in python, but I want to add > a windows GUI front end to it. Can this be done in python? What packages > would allow me to do that? > > > > Thanks. There is a GUI Generator for tkinter https

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-29 Thread Jach Feng
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道: > Fail on command line, > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > usage: infix2postfix.py [-h] [infix] > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 > >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-28 Thread Jach Feng
Mark Bourne 在 2023年1月28日 星期六晚上10:00:01 [UTC+8] 的信中寫道: > Jach Feng wrote: > > Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道: > >> Fail on command line, > >> > >> e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > >> u

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-28 Thread Jach Feng
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道: > Fail on command line, > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > usage: infix2postfix.py [-h] [infix] > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 > >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-25 Thread Jach Feng
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道: > Fail on command line, > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > usage: infix2postfix.py [-h] [infix] > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 > >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-25 Thread Jach Feng
Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道: > On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote: > > I was happy working with argparse during implement my script. To save the > > typing, I used a default equation for testing. > > > > sample = "-4^2+5

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Jach Feng
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道: > Fail on command line, > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > usage: infix2postfix.py [-h] [infix] > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 > >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Jach Feng
s(...)..." that could look like -a > followed by something. > > I see a deeper issue with interactions at the command shell level if parts of > the arithmetic expression are evaluated or changed before python is even > invoked. > > Then again, I may be misunderstandin

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Jach Feng
Michael Torrie 在 2023年1月25日 星期三凌晨3:05:44 [UTC+8] 的信中寫道: > On 1/23/23 18:58, Jach Feng wrote: > > More pathonic, but don't work. The '--' must be at index 1:-) > I'm very confused. Why are you even using argparse, since if you put -- > at index 1 then argpars

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Jach Feng
cameron...@gmail.com 在 2023年1月24日 星期二下午2:05:33 [UTC+8] 的信中寫道: > On 23Jan2023 17:58, Jach Feng wrote: > >>>> parser.parse_args(['--', 'infix2postfix.py', '-4.3+5']) > >usage: [-h] infix > >: error: unrecognized arguments: -4.3+5 >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Jach Feng
Greg Ewing 在 2023年1月24日 星期二清晨7:33:43 [UTC+8] 的信中寫道: > >> On 2023-01-22 at 18:19:13 -0800, > >> Jach Feng wrote: > >>> 1) Modify the sys.argv by inserting an item '--' before parsing it, ie. > >>> sys.argv.insert(1, '--') > >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Jach Feng
Chris Angelico 在 2023年1月24日 星期二清晨5:00:27 [UTC+8] 的信中寫道: > On Tue, 24 Jan 2023 at 07:47, Cameron Simpson wrote: > > > > But for Jach Feng: the "--" is really expected as something the user > > does when they invoke your programme, _explicitly_ saying that what

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Jach Feng
2qdxy4rz...@potatochowder.com 在 2023年1月24日 星期二凌晨2:47:12 [UTC+8] 的信中寫道: > On 2023-01-22 at 18:19:13 -0800, > Jach Feng wrote: > > > 1) Modify the sys.argv by inserting an item '--' before parsing it, ie. > > sys.argv.insert(1, '--') > > ar

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-23 Thread Jach Feng
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8] 的信中寫道: > Fail on command line, > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > usage: infix2postfix.py [-h] [infix] > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 > >

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Jach Feng
Thomas Passin 在 2023年1月22日 星期日下午1:30:39 [UTC+8] 的信中寫道: > On 1/21/2023 10:11 PM, Jach Feng wrote: > > Fail on command line, > > > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > > usage: infix2postfix.py [-h] [infix] > > infix2postf

How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-21 Thread Jach Feng
Fail on command line, e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" usage: infix2postfix.py [-h] [infix] infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 Also fail in REPL, e:\Works\Python>py Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928

Re: How to enter escape character in a positional string argument from the command line?

2022-12-21 Thread Jach Feng
Chris Angelico 在 2022年12月21日 星期三下午1:02:01 [UTC+8] 的信中寫道: > On Wed, 21 Dec 2022 at 15:28, Jach Feng wrote: > > That's what I am taking this path under Windows now, the ultimate solution > > before Windows has shell similar to bash:-) > Technically, Windows DOES have a shel

Re: How to enter escape character in a positional string argument from the command line?

2022-12-20 Thread Jach Feng
ery...@gmail.com 在 2022年12月20日 星期二中午12:35:52 [UTC+8] 的信中寫道: > On 12/19/22, Jach Feng wrote: > > > > That's really good for Linux user! How about Windows? > In CMD, typing the "^" escape character at the end of a line ignores > the newline and prompts for &q

Re: How to enter escape character in a positional string argument from the command line?

2022-12-20 Thread Jach Feng
Thomas Passin 在 2022年12月20日 星期二上午11:36:41 [UTC+8] 的信中寫道: > On 12/19/2022 9:24 PM, Jach Feng wrote: > > Mark Bourne 在 2022年12月20日 星期二凌晨4:49:13 [UTC+8] 的信中寫道: > >> Jach Feng wrote: > >>> I have a script using the argparse module. I want to enter the string

Re: How to enter escape character in a positional string argument from the command line?

2022-12-19 Thread Jach Feng
Mark Bourne 在 2022年12月20日 星期二凌晨4:49:13 [UTC+8] 的信中寫道: > Jach Feng wrote: > > I have a script using the argparse module. I want to enter the string > > "step\x0A" as one of its positional arguments. I expect this string has a > > length of 5, but it gives 8. Obviou

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-12 Thread Jach Feng
moi 在 2022年12月12日 星期一下午5:38:50 [UTC+8] 的信中寫道: > >>> ast.literal_eval("r'\x7a'") == ast.literal_eval("r'z'") > True > >>> ast.literal_eval("r'\xe0'") == ast.literal_eval("r'à'") > True > >>> ast.literal_eval("r'\x9c'") == ast.literal_eval("r'œ'") > False > > - > > > >>> print(codec

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-09 Thread Jach Feng
> > parser.add_argument('data') > args = parser.parse_args() > print(f'Input\n: -{args.data}- length {len(args.data)}') > for c in args.data: > print(f'{ord(c)} ',end='') > print() > > > Using bash on Linux: >

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-09 Thread Jach Feng
moi 在 2022年12月9日 星期五晚上11:41:20 [UTC+8] 的信中寫道: > PS C:\humour> py38 sysargwithliteral.py a\x0ab\x09c\x0a\x80uro\x0ax\x08z > cp1252 > a > b c > €uro > z > > PS C:\humour> $a = py38 sysargwithliteral.py a\x0ab\x09c\x0a\x80uro\x0ax\x08z > cp1252 > > PS C:\humour> licp($a) > a U+0061 > b U+0

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-08 Thread Jach Feng
Jach Feng 在 2022年12月7日 星期三上午10:23:20 [UTC+8] 的信中寫道: > s0 = r'\x0a' > At this moment it was done by > > def to1byte(matchobj): > return chr(int('0x' + matchobj.group(1), 16)) > s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0) > >

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-08 Thread Jach Feng
Jach Feng 在 2022年12月7日 星期三上午10:23:20 [UTC+8] 的信中寫道: > s0 = r'\x0a' > At this moment it was done by > > def to1byte(matchobj): > return chr(int('0x' + matchobj.group(1), 16)) > s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0) > >

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-07 Thread Jach Feng
Peter Otten 在 2022年12月8日 星期四清晨5:17:59 [UTC+8] 的信中寫道: > On 07/12/2022 03:23, Jach Feng wrote: > > s0 = r'\x0a' > > At this moment it was done by > > > > def to1byte(matchobj): > > return chr(int('0x' + matchobj.group(1), 16))

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-07 Thread Jach Feng
Roel Schroeven 在 2022年12月7日 星期三下午4:42:48 [UTC+8] 的信中寫道: > Op 7/12/2022 om 4:37 schreef Jach Feng: > > MRAB 在 2022年12月7日 星期三上午11:04:43 [UTC+8] 的信中寫道: > > > On 2022-12-07 02:23, Jach Feng wrote: > > > > s0 = r'\x0a' > > > > At this moment i

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-07 Thread Jach Feng
Thomas Passin 在 2022年12月7日 星期三中午12:51:32 [UTC+8] 的信中寫道: > On 12/6/2022 9:23 PM, Jach Feng wrote: > > s0 = r'\x0a' > > At this moment it was done by > > > > def to1byte(matchobj): > > return chr(int('0x' + matchobj.group(1), 16))

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-06 Thread Jach Feng
MRAB 在 2022年12月7日 星期三上午11:04:43 [UTC+8] 的信中寫道: > On 2022-12-07 02:23, Jach Feng wrote: > > s0 = r'\x0a' > > At this moment it was done by > > > > def to1byte(matchobj): > > return chr(int('0x' + matchobj.group(1), 16)) > > s1

How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-06 Thread Jach Feng
s0 = r'\x0a' At this moment it was done by def to1byte(matchobj): return chr(int('0x' + matchobj.group(1), 16)) s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0) But, is it that difficult on doing this simple thing? --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: Importlib behaves differently when importing pyd file

2022-11-18 Thread Jach Feng
Dieter Maurer 在 2022年11月17日 星期四凌晨1:12:20 [UTC+8] 的信中寫道: > Jach Feng wrote at 2022-11-15 22:52 -0800: > >My working directory d:\Works\Python\ has a package 'fitz' looks like this: > > > >fitz\ > >__init__.py > >fitz.py

Importlib behaves differently when importing pyd file

2022-11-16 Thread Jach Feng
My working directory d:\Works\Python\ has a package 'fitz' looks like this: fitz\ __init__.py fitz.py utils.py _fitz.pyd There is a statement in fitz.py: return importlib.import_module('fitz._fitz') It works fine under Python 3.4 interpreter: >>> import fi

Re: for -- else: what was the motivation?

2022-10-10 Thread Jach Feng
Axy 在 2022年10月10日 星期一下午5:55:29 [UTC+8] 的信中寫道: > On 09/10/2022 03:33, Jach Feng wrote: > > The else is always coming with the break, not the for. > However, the compiler does not complain. Sure, the compiler will not complain even in a IOCCC contest:-) > > but the [for...else]

Re: for -- else: what was the motivation?

2022-10-09 Thread Jach Feng
Axy 在 2022年10月8日 星期六上午11:39:44 [UTC+8] 的信中寫道: > Hi there, > > this is rather a philosophical question, but I assume I miss something. > I don't remember I ever used else clause for years I was with python and > my expectation was it executed only if the the main body was never run. > Ha-ha! I

Re: How to make a variable's late binding crosses the module boundary?

2022-09-01 Thread Jach Feng
ery...@gmail.com 在 2022年9月2日 星期五凌晨12:41:46 [UTC+8] 的信中寫道: > On 8/31/22, Jach Feng wrote: > > > > I found that using "from test import *" in test2.py makes test2's relation > > to "test" almost like the function's relation to the module

Re: How to make a variable's late binding crosses the module boundary?

2022-09-01 Thread Jach Feng
Mark Bourne 在 2022年9月1日 星期四凌晨2:43:40 [UTC+8] 的信中寫道: > Jach Feng wrote: > > Mark Bourne 在 2022年8月29日 星期一下午6:40:59 [UTC+8] 的信中寫道: > >> Jach Feng wrote: > >>> Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道: > >>>> On Mon, 29 Aug 2022 at 15:54

Re: How to make a variable's late binding crosses the module boundary?

2022-08-29 Thread Jach Feng
Mark Bourne 在 2022年8月29日 星期一下午6:40:59 [UTC+8] 的信中寫道: > Jach Feng wrote: > > Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道: > >> On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote: > >>> > >>> Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫

Re: How to make a variable's late binding crosses the module boundary?

2022-08-29 Thread Jach Feng
Chris Angelico 在 2022年8月29日 星期一下午1:58:58 [UTC+8] 的信中寫道: > On Mon, 29 Aug 2022 at 15:54, Jach Feng wrote: > > > > Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道: > > > On 8/27/22 7:42 AM, Mark Bourne wrote: > > > > Jach Feng wrote: > > &

Re: How to make a variable's late binding crosses the module boundary?

2022-08-28 Thread Jach Feng
Richard Damon 在 2022年8月29日 星期一上午10:47:08 [UTC+8] 的信中寫道: > On 8/27/22 7:42 AM, Mark Bourne wrote: > > Jach Feng wrote: > >> I have two files: test.py and test2.py > >> --test.py-- > >> x = 2 > >> def foo(): > >> print(x) > >

Re: How to make a variable's late binding crosses the module boundary?

2022-08-28 Thread Jach Feng
Mark Bourne 在 2022年8月27日 星期六晚上7:42:37 [UTC+8] 的信中寫道: > import test > test.x = 4 > test.foo() > > -- > Mark. Yes, you are right. But because of I am using "from test import *" which makes the name "test" disappear in the test2 scope, so this is not work. I solved this problem by moving "x" to

Re: Behavior of the for-else construct

2022-03-03 Thread Jach Feng
I never feel confused by "else" because I always think it in "break...else", not "for...else". For those who always think in "for...else" deserves this confusion and it can't be just escaped by replacing with another magic word such as "then" or "finally" etc:-) --Jach -- https://mail.python.

Re: frozenset can be altered by |=

2021-11-21 Thread Jach Feng
Marco Sulla 在 2021年11月20日 星期六上午5:12:19 [UTC+8] 的信中寫道: > (venv_3_10) marco@buzz:~$ python > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > [GCC 10.1.1 20200718] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> a = frozenset((3, 4)) >

Re: Definitive guide for Regex

2021-10-01 Thread Jach Feng
Shaozhong SHI 在 2021年9月30日 星期四下午7:29:47 [UTC+8] 的信中寫道: > Dear All, > > I am trying to look for a definitive guide for Regex in Python. > Can anyone help? > > Regards, > > David Try the rexegg.com which is a site dedicate to this subject and has many resources. --Jach -- https://mail.pytho

Re: Ask for help on using re

2021-08-07 Thread Jach Feng
jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: > Il 05/08/2021 11:40, Jach Feng ha scritto: > > I want to distinguish between numbers with/without a dot attached: > > > >>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > >>>> re.compi

Re: Ask for help on using re

2021-08-06 Thread Jach Feng
jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: > Il 05/08/2021 11:40, Jach Feng ha scritto: > > I want to distinguish between numbers with/without a dot attached: > > > >>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > >>>> re.compi

Re: Ask for help on using re

2021-08-06 Thread Jach Feng
ast 在 2021年8月5日 星期四下午11:29:15 [UTC+8] 的信中寫道: > Le 05/08/2021 à 17:11, ast a écrit : > > Le 05/08/2021 à 11:40, Jach Feng a écrit : > >> I want to distinguish between numbers with/without a dot attached: > >> > >>>>> text = 'ch 1. is\nch 23. is\n

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Jach Feng
> > s = "Jack Brandom" > > s[3 : -13 : -1] > >> 'kcaJ' > >> I have no idea how to replace that -13 with a positive index. Is it > >> possible at all? That's not possible because a positive index is relative to the leftmost item 0 Below is some rules of slice usage which I collected so

Re: Ask for help on using re

2021-08-05 Thread Jach Feng
Neil 在 2021年8月5日 星期四下午6:36:58 [UTC+8] 的信中寫道: > Jach Feng wrote: > > I want to distinguish between numbers with/without a dot attached: > > > >>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' > >>>> re.compile(r'ch \d{1,}[.]'

Ask for help on using re

2021-08-05 Thread Jach Feng
I want to distinguish between numbers with/without a dot attached: >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' >>> re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] >>> re.compile(r'ch \d{1,}[^.]').findall(text) ['ch 23', 'ch 4 ', 'ch 56 '] I can guess why the 'ch 23' appear

Re: Tkinter problem

2021-06-19 Thread Jach Feng
Christian Gollwitzer 在 2021年6月19日 星期六下午1:54:46 [UTC+8] 的信中寫道: > Am 19.06.21 um 07:16 schrieb Jach Feng: > > Christian Gollwitzer 在 2021年6月19日 星期六下午12:27:54 [UTC+8] 的信中寫道: > >> Am 19.06.21 um 05:59 schrieb Jach Feng: > >>>>>> import tkinter as Tk &g

Re: Tkinter problem

2021-06-19 Thread Jach Feng
Christian Gollwitzer 在 2021年6月19日 星期六下午12:27:54 [UTC+8] 的信中寫道: > Am 19.06.21 um 05:59 schrieb Jach Feng: > >>>> import tkinter as Tk > >>>> Tk > > > 'C:\\Users\\jfong\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\tkinter\\__init__.py&

Re: Tkinter problem

2021-06-19 Thread Jach Feng
liyaanns...@gmail.com 在 2021年6月18日 星期五下午2:28:35 [UTC+8] 的信中寫道: > I am using Colab. How could solve this problem. > import tkinter as Tk > from tkinter import * > import sys > import os > #create main window > master = Tk() > master.title("tester") > master.geometry("300x100") > > > #make

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-16 Thread Jach Feng
Greg Ewing 在 2021年6月16日 星期三上午7:11:35 [UTC+8] 的信中寫道: > On 15/06/21 7:32 pm, Jach Feng wrote: > > But usually the list creation is not in simple way:-) for example: > >>>> a = [1,2] > >>>> m = [a for i in range(3)] > >>>> m > > [[1

Re: Is there a way to get the following result in Python?

2021-06-15 Thread Jach Feng
Peter Otten 在 2021年6月15日 星期二下午2:48:07 [UTC+8] 的信中寫道: > On 12/06/2021 04:02, Jach Feng wrote: > > >>>> def foo(): > > ... # do something > > ... > >>>> a = [] > >>>> for i in range(3): > > ... a.append(foo()) > > .

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread Jach Feng
Greg Ewing 在 2021年6月15日 星期二下午3:01:46 [UTC+8] 的信中寫道: > On 15/06/21 3:18 pm, Jach Feng wrote: > > From a user's point, I don't really care how Python creates thoseinstances, > > > either using an already exist one or create a new one, as > > long as each

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-15 Thread Jach Feng
Chris Angelico 在 2021年6月15日 星期二上午5:23:12 [UTC+8] 的信中寫道: > On Tue, Jun 15, 2021 at 7:11 AM Rob Cliffe via Python-list > wrote: > > > > This puzzled me, so I played around with it a bit (Python 3.8.3): > > > > n = [] > > for i in range(3): > > n.append((1,7,-3,None,"x")) > > for i in range(3

Is there a way to get the following result in Python?

2021-06-14 Thread Jach Feng
>>> def foo(): ... # do something ... >>> a = [] >>> for i in range(3): ... a.append(foo()) ... >>> a [] >>> --Jach -- https://mail.python.org/mailman/listinfo/python-list

Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-14 Thread Jach Feng
>>> n = [(1,2) for i in range(3)] >>> n [(1, 2), (1, 2), (1, 2)] >>> id(n[0]) == id(n[1]) == id(n[2]) True >>> m = [[1,2] for i in range(3)] >>> m [[1, 2], [1, 2], [1, 2]] >>> id(m[0]) == id(m[1]) == id(m[2]) False >>> --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Jach Feng
pjfa...@earthlink.net 在 2021年5月31日 星期一上午1:42:43 [UTC+8] 的信中寫道: > I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3 > at that time), but could not figure out how to use it to debug a python > script that uses the curses module. > > Does anyone here know if winpdb-reborn

Re: [ANN] Free Python tutorial with exercises, cscx.org

2021-04-06 Thread Jach Feng
Rudy Matela 在 2021年4月1日 星期四下午11:13:03 [UTC+8] 的信中寫道: > Hello python-list members, > > I would like to announce the following educational project: > > Computer Science by Example https://cscx.org/ is a collection of short > programming exercises. The site can automatically grade students' > so

Re: What's the meaning the "backlog" in the socket.listen(backlog) is?

2021-02-16 Thread Jach Feng
Kushal Kumaran 在 2021年2月17日 星期三下午12:11:04 [UTC+8] 的信中寫道: > On Tue, Feb 16 2021 at 07:24:30 PM, Jach Feng wrote: > > I am experimenting with multithreading-socket these days. I build a > > server to handle each client in a separate thread. All are running on > > my lo

What's the meaning the "backlog" in the socket.listen(backlog) is?

2021-02-16 Thread Jach Feng
I am experimenting with multithreading-socket these days. I build a server to handle each client in a separate thread. All are running on my local PC. It works fine except the listen() method. I set listen(2) and expect to see "error" when more clients than "the maximum number of queued connect

To whom he want to set breakpoint on negative line number in pdb

2020-12-12 Thread Jach Feng
I use .pdbrc file to help debugging. To avoid editing this file frequently when source was modified, I need this feature. I modify the checkline function in pdb.py from ... line = linecache.getline(filename, lineno, globs) if not line: to ... lines = linecache.get