[issue44930] super-Matlab-style ranged list literal initialization

2021-08-17 Thread wang xuancong
wang xuancong added the comment: Another lazy explanation not wanting to improve anything -- ___ Python tracker <https://bugs.python.org/issue44930> ___ ___

[issue44930] super-Matlab-style ranged list literal initialization

2021-08-16 Thread wang xuancong
New submission from wang xuancong : Different from Python 2, Python 3 has removed the capability to create a list from a range. In Python 2, we can use range(1,100,2) to create a list [1, 3, 5, ..., 99], but in Python 3, we can only use list(range(1,100,2)) or [*range(1,100,2)] where

[issue44028] Request for locals().update() to work, it is

2021-05-09 Thread wang xuancong
wang xuancong added the comment: Thanks @terry.reedy for your expert-level good comments! 1. "In Python 3, the one *implementation*, and its lookup mode, are fixed. The slower implementation was dropped because it was not thought worth the bother." If I remember correctly, the p

[issue44028] Request for locals().update() to work, it is

2021-05-04 Thread wang xuancong
wang xuancong added the comment: Of course, I am aware of that. As elite-level Python programmers, we should all be aware of security issues whenever we deal with exec() and eval(). -- ___ Python tracker <https://bugs.python.org/issue44

[issue44028] Request for locals().update() to work, it is

2021-05-03 Thread wang xuancong
New submission from wang xuancong : In general, the ability to update local variables is very important and it simplifies life tremendously. For example, in machine learning, it allows saving/loading arbitrary-format datasets and arbitrary-structure neural networks (NN) using a single line

[issue38503] bug: string search can find \n, but can NEVER find \r

2019-10-17 Thread wang xuancong
New submission from wang xuancong : If I load a file which contains "\r" and "\n", I can find "\n", but not "\r". This behaviour is inconsistent in Python 3, but consistent in Python 2. >>> open('./3cjkxdnw/accessibilityLog/1570181896323

[issue38315] Provide defaultdict variant that passes key to default_factory

2019-10-09 Thread wang xuancong
wang xuancong added the comment: I agree with Mark Amery. The reason why defaultdict still exists given that everything can be achieved by subclassing the built-in dict is because of convenience. I suggest maybe Python developer can put it into low priority instead. -- nosy

[issue38420] defaultdict does not support parametric lambda

2019-10-09 Thread wang xuancong
New submission from wang xuancong : A very common use of defaultdict is that if the key exist, use the corresponding mapped target, if the key does not exist, use the key itself. However, current Python 2/3 defaultdict does not support parametric lambda function: >>> from collectio

[issue37780] A strange bug in eval() not present in Python 3

2019-08-06 Thread wang xuancong
New submission from wang xuancong : We all know that since: [False, True, False].count(True) gives 1 eval('[False, True, False].count(True)') also gives 1. However, in Python 2, eval('[False, True, False].count(True)', {}, Counter()) gives 3, while eval('[False, True, False].count(True

[issue36047] socket file handle does not support stream write

2019-02-19 Thread wang xuancong
New submission from wang xuancong : Python3 programmers have forgotten to convert/implement the socket file descriptor for IO stream operation. Would you please add it? Thanks! import socket s = socket.socket() s.connect('localhost', 5432) S = s.makefile() # on Python2, the following works

[issue19522] A suggestion: python 3.* is not as convenient as python 2.*

2013-11-07 Thread wang xuancong
New submission from wang xuancong: Hi python developers, I notice that one major change in python 3 is that you make 'print' as a standard function, and it will require typing (). As you know, reading from and writing to IO is a high frequency operation. By entropy coding theorem, you should