[issue36453] pkgutil.get_importer only return the first valid path_hook(importer)

2020-03-27 Thread Windson Yang
Windson Yang added the comment: Any update? -- ___ Python tracker <https://bugs.python.org/issue36453> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36093] UnicodeEncodeError raise from smtplib.verify() method

2020-03-27 Thread Windson Yang
Windson Yang added the comment: Any update? -- ___ Python tracker <https://bugs.python.org/issue36093> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Windson Yang
New submission from Windson Yang : bisect_left should be similar to bisect_right. However, the current implement didn't reflect it. A little bit update for the bisect_left function could make the user easy to understand their relation. def bisect_left(a, x, lo=0, hi=None): if lo <

[issue38125] Can' build document in Sphinx v2.2.0

2019-10-28 Thread Windson Yang
Change by Windson Yang : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38125> ___ ___ Python-bugs-list

[issue38125] Can' build document in Sphinx v2.2.0

2019-09-11 Thread Windson Yang
New submission from Windson Yang : I got two errors when I try to build python document with make venv make html The first one is > Since v2.0, Sphinx uses "index" as master_doc by default. Please add > "master_doc = 'contents'" to your conf.py. After f

Re: What make function with huge list so slow

2019-08-25 Thread Windson Yang
> Figure out how much memory fib_dp is holding on to right before it returns > the answer. fib(40) is a _big_ number! And so is fib(39), and > fib(38), and fib(37), etc. By the time you're done, you're holding > on to quite a huge pile of storage here. Depending on how much

Re: What make function with huge list so slow

2019-08-25 Thread Windson Yang
'I'm just running them in succession and seeing how long they'. The full code looks like this, this is only an example.py here. and I run 'time python3 example.py' for each function. def fib_dp(n): dp = [0] * (n+1) if n <= 1: return n dp[0], dp[1] = 0, 1

Re: What make function with huge list so slow

2019-08-24 Thread Windson Yang
Thank you, Chris. I tried your suggestions. I don't think that is the reason, fib_dp_look() and fib_dp_set() which also allocation a big list can return in 2s. Chris Angelico 于2019年8月25日周日 上午11:27写道: > On Sun, Aug 25, 2019 at 12:56 PM Windson Yang wrote: > > > > I hav

What make function with huge list so slow

2019-08-24 Thread Windson Yang
I have two functions to calculate Fibonacci numbers. fib_dp use a list to store the calculated number. fib_dp2 just use two variables. def fib_dp(n): if n <= 1: return n dp = [0] * (n+1) dp[0], dp[1] = 0, 1 for i in range(2, n+1): dp[i]

Re: How should we use global variables correctly?

2019-08-23 Thread Windson Yang
are > pretty > >>much the same. Or I missed something? > >> > > > >One difference is that you could have many instances of Example, each > >with its own value of 'foo', whereas with a global 'foo' there can > >only be one value of 'foo' for the module.

Re: How should we use global variables correctly?

2019-08-23 Thread Windson Yang
ort and clean enough (didn't have a lot of other class), they are pretty much the same. Or I missed something? Chris Angelico 于2019年8月23日周五 上午9:34写道: > On Fri, Aug 23, 2019 at 11:24 AM Windson Yang wrote: > > > > Thank you all for the great explanation, I still trying to find s

Re: How should we use global variables correctly?

2019-08-22 Thread Windson Yang
Thank you all for the great explanation, I still trying to find some good example to use 'global', In CPython, I found an example use 'global' in cpython/Lib/zipfile.py _crctable = None def _gen_crc(crc): for j in range(8): if crc & 1: crc = (crc >> 1)

How should we use global variables correctly?

2019-08-22 Thread Windson Yang
I can 'feel' that global variables are evil. I also read lots of articles proves that (http://wiki.c2.com/?GlobalVariablesAreBad). However, I found CPython Lib use quite a lot of `global` keyword. So how should we use `global` keyword correctly? IIUC, it's fine that we use `global` keyword inside

Re: fopen() and open() in cpython

2019-08-14 Thread Windson Yang
Thank you so much for the answer, now it makes sense :D eryk sun 于2019年8月15日周四 上午12:27写道: > On 8/13/19, Windson Yang wrote: > > After my investigation, I found Since Python maintains its own buffer > when > > read/write files, the build-in python open() function wi

[issue37846] declare that Text I/O use buffer inside

2019-08-14 Thread Windson Yang
Windson Yang added the comment: I found the document is not that clear when I try to understand what happens when Python read/write a file. I'm not sure who also needs this information. As you said, It wouldn't help the user program in Python. However, make it more clear maybe help users

fopen() and open() in cpython

2019-08-13 Thread Windson Yang
After my investigation, I found Since Python maintains its own buffer when read/write files, the build-in python open() function will call the open() system call instead of calling standard io fopen() for caching. So when we read/write a file in Python, it would not call fopen(), fopen() only use

[issue37846] declare that Text I/O use buffer inside

2019-08-13 Thread Windson Yang
New submission from Windson Yang : At the beginning of https://docs.python.org/3.7/library/io.html#io.RawIOBase, we declared that > Binary I/O (also called buffered I/O) and > Raw I/O (also called unbuffered I/O) But we didn't mention if Text I/O use buffer or not which led to con

[issue29750] smtplib doesn't handle unicode passwords

2019-07-31 Thread Windson Yang
Windson Yang added the comment: I just updated the PR -- ___ Python tracker <https://bugs.python.org/issue29750> ___ ___ Python-bugs-list mailing list Unsub

[issue29750] smtplib doesn't handle unicode passwords

2019-07-31 Thread Windson Yang
Change by Windson Yang : -- pull_requests: +14813 pull_request: https://github.com/python/cpython/pull/15064 ___ Python tracker <https://bugs.python.org/issue29

[issue29750] smtplib doesn't handle unicode passwords

2019-07-31 Thread Windson Yang
Windson Yang added the comment: Sorry, I forgot about this PR, I will update the patch depends on review soon :D -- ___ Python tracker <https://bugs.python.org/issue29

Re: Understand workflow about reading and writing files in Python

2019-06-24 Thread Windson Yang
DL Neil 于2019年6月24日周一 上午11:18写道: > Yes, better to reply to list - others may 'jump in'... > > > On 20/06/19 5:37 PM, Windson Yang wrote: > > Thank you so much for you review DL Neil, it really helps :D. However, > > there are some parts still confused me, I re

Re: Understand workflow about reading and writing files in Python

2019-06-24 Thread Windson Yang
When you said "C-runtime buffered I/O", are you talking about Standard I/O in C (FILE * object)? AFAIN, In CPython, we didn't use Standard I/O, right? Dennis Lee Bieber 于2019年6月25日周二 上午12:48写道: > On Mon, 24 Jun 2019 15:18:26 +1200, DL Neil > declaimed the following: > > > > > >However, the

Fwd: Understand workflow about reading and writing files in Python

2019-06-23 Thread Windson Yang
of (2) must be larger than (1) and larger than (2) - > for reasons already illustrated. > Is this a typo? (2) larger than (1) larger than (2)? > > I recall learning how to use buffers with a series of hand-drawn block > diagrams. Recommend you try similarly! > > > Now, let'

Understand workflow about reading and writing files in Python

2019-06-18 Thread Windson Yang
I'm trying to understand the workflow of how Python read/writes data with buffer. I will be appreciated if someone can review it. ### Read n data 1. If the data already in the buffer, return data 2. If the data not in the buffer: 1. copy all the current data from the buffer 2. create a

Understand workflow about reading and writing files in Python

2019-06-17 Thread Windson Yang
I'm trying to understand the workflow of how python read/writes files with buffer. I drew a diagram for it. I will be appreciated if someone can review the diagram :D [image: 屏幕快照 2019-06-15 下午12.50.57.png] -- https://mail.python.org/mailman/listinfo/python-list

[issue15474] Differentiate decorator and decorator factory in docs

2019-06-03 Thread Windson Yang
Windson Yang added the comment: Hi, Andrés Delfino. Are you still working on it? -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue15

[issue37086] time.sleep error message misleading

2019-06-02 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +13652 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13768 ___ Python tracker <https://bugs.python.org/issu

[issue37086] time.sleep error message misleading

2019-06-02 Thread Windson Yang
Windson Yang added the comment: I just create a PR for it. -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue37086> ___ ___ Python-bug

[issue26468] shutil.copy2 raises OSError if filesystem doesn't support chmod

2019-06-02 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +13651 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13765 ___ Python tracker <https://bugs.python.org/issu

Questions about the IO modules and C-api

2019-06-02 Thread Windson Yang
I have some questions about the IO modules. 1. My script: f = open('myfile, 'a+b') f.close() I added a printf statement at the beginning of _io_open_impl , the output is: _io_open _io_open _io_open

[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-31 Thread Windson Yang
Change by Windson Yang : -- pull_requests: +13602 pull_request: https://github.com/python/cpython/pull/13715 ___ Python tracker <https://bugs.python.org/issue37

[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-31 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +13600 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13713 ___ Python tracker <https://bugs.python.org/issu

[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-31 Thread Windson Yang
Windson Yang added the comment: Sure. Feel free to edit my PR. -- ___ Python tracker <https://bugs.python.org/issue37073> ___ ___ Python-bugs-list mailin

write function call _io_BufferedWriter_write_impl twice?

2019-05-29 Thread Windson Yang
My script looks like this: f = open('myfile', 'a+b') f.write(b'abcde') And I also add a `printf` statement in the _io_BufferedWriter_write_impl function. static PyObject

[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-28 Thread Windson Yang
New submission from Windson Yang : > PyBytes_FromStringAndSize(const char *v, Py_ssize_t len): > Return a new bytes object with a copy of the string v as value and length len > on success, and NULL on failure. If v is NULL, the contents of the bytes > object are uninitialized.

Duplicate function in thread_pthread.h

2019-05-27 Thread Windson Yang
When I try to understand the code about the thread. I found the thread_pthread.h file has some duplicate functions. Like `PyThread_free_lock`, `PyThread_release_lock`, `PyThread_acquire_lock_timed`. IIUC, C doesn't support function overload. So why we have functions with the same name and args? --

[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-23 Thread Windson Yang
Windson Yang added the comment: I think we should mention it at the document, like in the tell() function. -- ___ Python tracker <https://bugs.python.org/issue36

[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-23 Thread Windson Yang
Windson Yang added the comment: I'm not sure it's a bug. When you write binary data to file (use BufferedIOBase by default). It actually writes the data to a buffer. That is why tell() gets out of sync. You can follow the instrument belolw. For instance, call flush() after writing to get

CPython compiled failed in macOS

2019-05-21 Thread Windson Yang
version: macOS 10.14.4, Apple LLVM version 10.0.1 (clang-1001.0.46.4). I cloned the CPython source code from GitHub then compiled it which used to work quite well. However, I messed up my terminal a few days ago for installing gdb. Now when I try to compile the latest CPython source code with

[issue21861] io class name are hardcoded in reprs

2019-05-16 Thread Windson Yang
Windson Yang added the comment: IIUC, in the c code we just hardcode the name "_io.FileIO" for "PyFileIO_Type" in https://github.com/python/cpython/blob/master/Modules/_io/fileio.c#L1180. If we want to get a dynamic name, we should replace the hardcode name with th

[issue18911] minidom does not encode correctly when calling Document.writexml

2019-05-15 Thread Windson Yang
Windson Yang added the comment: I added a PR for like this: .. note:: You should specify the "xmlcharrefreplace" error handler when open a file with specified encoding:: writer = open( filename, "w", encoding="utf-8

[issue18911] minidom does not encode correctly when calling Document.writexml

2019-05-15 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +13263 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue26124] shlex.quote and pipes.quote do not quote shell keywords

2019-05-14 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +13245 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue9267] Update pickle opcode documentation in pickletools for 3.x

2019-05-13 Thread Windson Yang
Windson Yang added the comment: Where are the documents actually? -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue9267> ___ ___ Pytho

[issue30535] Explicitly note that meta_path is not empty

2019-05-13 Thread Windson Yang
Windson Yang added the comment: I created a PR for it. TBO, meta_path is not a good name since it doesn't contain any *path* at all. -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue30

[issue30535] Explicitly note that meta_path is not empty

2019-05-13 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +13211 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue30535> ___ ___ Py

[issue36689] docs: os.path.commonpath raises ValueError for different drives

2019-05-12 Thread Windson Yang
Windson Yang added the comment: An easy fix would be "Raise ValueError if paths contain (note: use contain instead of contains) both absolute and relative pathnames or the path are on the different drives." -- nosy: +Windson Yang

[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-05-07 Thread Windson Yang
Windson Yang added the comment: Hello, @Rémi, are you still working on this issue? -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue18

[issue36823] shutil.copytree copies directories and files but fails with that same directory with '[Errno 1] Operation not permitted')

2019-05-07 Thread Windson Yang
Windson Yang added the comment: Just to make sure, the expected behavior would be the items should not be copied because of the permission and the error messages above, right? -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.

[issue34155] email.utils.parseaddr mistakenly parse an email

2019-05-03 Thread Windson Yang
Windson Yang added the comment: Frome the answer from Alnitak (https://stackoverflow.com/questions/12355858/how-many-symbol-can-be-in-an-email-address). Maybe we should raise an error when the address has multiple @ in it. -- ___ Python tracker

[issue34155] email.utils.parseaddr mistakenly parse an email

2019-05-02 Thread Windson Yang
Windson Yang added the comment: I found the issue located in https://github.com/python/cpython/blob/master/Lib/email/_parseaddr.py#L277 elif self.field[self.pos] in '.@': # email address is just an addrspec # this isn't very efficient since we start over self.pos = oldpos

[issue36762] Teach "import *" to warn when overwriting globals or builtins

2019-05-01 Thread Windson Yang
Windson Yang added the comment: Another question will be are we going to replace the * in our source code in the future? Since I found lots of our code use 'from xxx import *' pattern. -- nosy: +Windson Yang ___ Python tracker <ht

[issue36761] Extended slice assignment + iterable unpacking

2019-05-01 Thread Windson Yang
Windson Yang added the comment: In your first case, *any positive index except 2 will work*, For example: L = [0, 1, 2] L[::1], *rest = "abcdef" # L became ['a'] or L[::3], *rest = "abcdef" # L became ['a', 1, 2] I found iff when you change the length of L to 1(L[::3]

[issue36757] uuid constructor accept invalid strings (extra dash)

2019-05-01 Thread Windson Yang
Windson Yang added the comment: > Maybe a line should be added in the documentation to prevent people using > this as a validator without more check? I don't expect uuid.UUID could be used as a validator myself, but I agreed we can warn users in the documentation if lots of them c

[issue36759] datetime: astimezone() results in OSError: [Errno 22] Invalid argument

2019-05-01 Thread Windson Yang
Windson Yang added the comment: Thanks, SilentGhost, you are right. I will leave this to a Windows expert instead. -- ___ Python tracker <https://bugs.python.org/issue36

[issue36759] datetime: astimezone() results in OSError: [Errno 22] Invalid argument

2019-04-30 Thread Windson Yang
Windson Yang added the comment: on macOS 10.14.4, I got `ValueError: offset must be a timedelta representing a whole number of minutes, not datetime.timedelta(0, 29143).` I will do some research to see why this happen. -- nosy: +Windson Yang

[issue36731] Add example to priority queue

2019-04-25 Thread Windson Yang
New submission from Windson Yang : We don't have the base example for priority queue in https://docs.python.org/3.8/library/heapq.html#priority-queue-implementation-notes, We can add something like: > q = Q.PriorityQueue() > q.put(10) > q.put(1) > q.put(5) > while not q.emp

[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12871 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36654> ___ ___ Py

[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Windson Yang
Windson Yang added the comment: Yes, I can make a PR for it. -- ___ Python tracker <https://bugs.python.org/issue36654> ___ ___ Python-bugs-list mailin

[issue36678] duplicate method definitions in Lib/test/test_dataclasses.py

2019-04-21 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12826 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue36683] duplicate method definition in Lib/test/test_utf8_mode.py

2019-04-20 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12821 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue36682] duplicate method definitions in Lib/test/test_sys_setprofile.py

2019-04-20 Thread Windson Yang
Change by Windson Yang : -- pull_requests: +12820 ___ Python tracker <https://bugs.python.org/issue36682> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36682] duplicate method definitions in Lib/test/test_sys_setprofile.py

2019-04-20 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12819 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue36681] duplicate method definition in Lib/test/test_logging.py

2019-04-20 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12818 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue36680] duplicate method definition in Lib/test/test_importlib/test_util.py

2019-04-20 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12817 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue36679] duplicate method definition in Lib/test/test_genericclass.py

2019-04-20 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12816 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue36661] Missing dataclass decorator import in dataclasses module docs

2019-04-20 Thread Windson Yang
Windson Yang added the comment: I agreed most of the documents won't need the change, but some documents like https://docs.python.org/3/library/dataclasses.html#dataclasses.field didn't mention we have to run `from typing import List` and I guess most developers not familiar

[issue36661] Missing dataclass decorator import in dataclasses module docs

2019-04-19 Thread Windson Yang
Windson Yang added the comment: I can find some example in the docs that didn't `import the correct module` even in the first example. Should we add the `import` statement for all of them? -- nosy: +Windson Yang ___ Python tracker <ht

[issue36654] Add example to tokenize.tokenize

2019-04-17 Thread Windson Yang
New submission from Windson Yang : > The tokenize() generator requires one argument, readline, which must be a > callable object which provides the same interface as the io.IOBase.readline() > method of file objects. Each call to the function should return one line of > input as

[issue14817] pkgutil.extend_path has no tests

2019-04-17 Thread Windson Yang
Windson Yang added the comment: I added some tests in the PR. Actually, there are some tests for extend_path already (see https://github.com/python/cpython/blob/master/Lib/test/test_pkgutil.py#L235). However, I didn't test every line of the code in the extend_path function

[issue14817] pkgutil.extend_path has no tests

2019-04-17 Thread Windson Yang
Change by Windson Yang : -- keywords: +patch pull_requests: +12795 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue14817> ___ ___ Py

[issue36453] get_importer only return the first valid path_hook(importer)

2019-03-27 Thread Windson Yang
New submission from Windson Yang : Is it an expected behavior the get_importer function only returns the first valid path_hook(importer) from sys.path_hooks? def get_importer(path_item): """Retrieve a finder for the given path item The returned f

[issue14817] pkgutil.extend_path has no tests

2019-03-26 Thread Windson Yang
Windson Yang added the comment: My base idea would be some unittests for the function like: class ExtendPathBaseTests(unittest.TestCase): def test_input_string(self): path = 'path' name = 'foo' self.assertEqual('path', pkgutil.extend_path(path, name)) def

[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-03-24 Thread Windson Yang
Windson Yang added the comment: This looks interesting. Let me try to fix it. -- nosy: +Windson Yang versions: +Python 3.8, Python 3.9 -Python 3.6 ___ Python tracker <https://bugs.python.org/issue36

[issue14817] pkgutil.extend_path has no tests

2019-03-21 Thread Windson Yang
Windson Yang added the comment: I would like to work on this and make a PR. -- nosy: +Windson Yang type: -> enhancement versions: +Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issu

[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-20 Thread Windson Yang
Windson Yang added the comment: The fixed looks easy, we call `PyObject_CallFinalizerFromDealloc` before PyObject_ClearWeakRefs. But I can't come up with the use case for testing when generator resurrects from `PyObject_CallFinalizer`. Any ideas

[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-16 Thread Windson Yang
Windson Yang added the comment: In the docs https://docs.python.org/3/extending/newtypes.html#weak-reference-support points out: > /* Clear weakrefs first before calling any destructors */ So maybe we should also update the docs after fix this bug. Anyway, I will try to understand/

[issue26018] documentation of ZipFile file name encoding

2019-03-09 Thread Windson Yang
Windson Yang added the comment: Please ignore the last message, the docs locate in 3.4 and 3.5 -- ___ Python tracker <https://bugs.python.org/issue26

[issue26018] documentation of ZipFile file name encoding

2019-03-09 Thread Windson Yang
Windson Yang added the comment: I can't find the Note in the current document -- nosy: +Windson Yang versions: +Python 3.4, Python 3.5 -Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue26

[issue18697] Unify arguments names in Unicode object C API documentation

2019-03-09 Thread Windson Yang
Change by Windson Yang : -- versions: -Python 2.7 ___ Python tracker <https://bugs.python.org/issue18697> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18697] Unify arguments names in Unicode object C API documentation

2019-03-09 Thread Windson Yang
Change by Windson Yang : -- versions: +Python 2.7, Python 3.4, Python 3.5 ___ Python tracker <https://bugs.python.org/issue18697> ___ ___ Python-bugs-list mailin

[issue18697] Unify arguments names in Unicode object C API documentation

2019-03-09 Thread Windson Yang
Windson Yang added the comment: I agreed with @Matheus, it would be better than the current implementation -- nosy: +Windson Yang versions: +Python 3.6, Python 3.7 -Python 2.7, Python 3.4, Python 3.5 ___ Python tracker <https://bugs.python.

[issue36248] document about `or`, `and` operator.

2019-03-09 Thread Windson Yang
Windson Yang added the comment: SilentGhost, I think you give a great example to explain this behavior. If the behavior is obvious to you, we can close this issue. -- ___ Python tracker <https://bugs.python.org/issue36

[issue36248] document about `or`, `and` operator.

2019-03-09 Thread Windson Yang
Windson Yang added the comment: Thank you Serhiy, we did document here: > The expression x and y first evaluates x; if x is false, its value is > returned; otherwise, y is evaluated and the resulting value is returned. > The expression x or y first evaluates x; if x is true,

[issue36248] document about `or`, `and` operator.

2019-03-08 Thread Windson Yang
New submission from Windson Yang : I think we should document the behavior as below, (maybe at https://docs.python.org/3/reference/expressions.html#operator-precedence) >>> 1 or 0 and 3 1 >>> 0 or 1 and 3 3 Please correct me if we already document it. -- ass

[issue36230] Please sort assertSetEqual's output

2019-03-08 Thread Windson Yang
Windson Yang added the comment: My point is careful about the non-sortable object. My mistake, this should be an enhancement, not a bug. -- versions: -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <ht

[issue36230] Please sort assertSetEqual's output

2019-03-07 Thread Windson Yang
Change by Windson Yang : -- versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue36230> ___ ___

[issue36230] Please sort assertSetEqual's output

2019-03-07 Thread Windson Yang
Windson Yang added the comment: Just to be clear, as Raymond said, when we have two non-sortable objects (for instance, two instances which their class didn't implement the __lt__ and __gt__ methods), we should compare their repr() without sort() like now. -- nosy: +Windson Yang

[issue36203] PyWeakref_NewRef docs are misleading

2019-03-07 Thread Windson Yang
Windson Yang added the comment: It looks to me the fix is easy, we just will return NULL and raise TypeError when the callback is not callable, None, or NULL. I'm not an expert in C, but I would love to create a PR for it if you don't have time

[issue36203] PyWeakref_NewRef docs are misleading

2019-03-06 Thread Windson Yang
Windson Yang added the comment: Yes, Maxwell. I guess the docs are misleading, the code locate in https://github.com/python/cpython/blob/master/Objects/weakrefobject.c#L748 if (callback == Py_None) callback = NULL; if (callback == NULL) /* return existing weak reference

[issue29539] [smtplib] collect response data for all recipients

2019-02-28 Thread Windson Yang
Windson Yang added the comment: sls, are you working on this feature now? -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue29539> ___ ___

[issue36153] Freeze support documentation is misleading.

2019-02-28 Thread Windson Yang
Windson Yang added the comment: IIUC, your script (using Sklearn/tensorflow) will cause an infinite loop when building with pyinstaller. Would you mind upload an example script so I can try to reproduce it? -- nosy: +Windson Yang ___ Python

[issue36093] UnicodeEncodeError raise from smtplib.verify() method

2019-02-23 Thread Windson Yang
Windson Yang added the comment: Btw, from the docs https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail > msg may be a string containing characters in the ASCII range, or a byte > string. A string is encoded to bytes using the ascii codec, and lone \r and > \n c

[issue36093] UnicodeEncodeError raise from smtplib.verify() method

2019-02-22 Thread Windson Yang
New submission from Windson Yang : AFAIK, the email address should support non-ASCII character (from https://stackoverflow.com/questions/760150/can-an-email-address-contain-international-non-english-characters and SMTPUTF8 option from https://docs.python.org/3/library/smtplib.html

[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Windson Yang
Windson Yang added the comment: Hello, Zahash Z. May I ask what is your expected behavior for the return value of __repr__() from PriorityQueue. I'm agreed with Stéphane Wirtel, I don't think returning all the items would be a good idea, maybe we can improve it in another way. For instance

[issue36047] socket file handle does not support stream write

2019-02-19 Thread Windson Yang
Windson Yang added the comment: >From the docs >https://docs.python.org/3/library/socket.html#socket.socket.makefile, the >default mode for makefile() is 'r' (only readable). In your example, just use >S = s.makefile(mode='w') instead. -- nosy: +

[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-18 Thread Windson Yang
Windson Yang added the comment: I think right now we can > Change mode() to return the first tie instead of raising an exception. This > is a behavior change but leaves you with the cleanest API going forward. as well as > Add a Deprecation warning to the current behavior of mo

[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-16 Thread Windson Yang
Windson Yang added the comment: I only tested stats.mode() from scipy, data = 'BBAAC' should also return 'A'. But in your code **return return Counter(seq).most_common(1)[0][0]** will return B. Did I miss something? -- ___ Python tracker <ht

[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-16 Thread Windson Yang
Windson Yang added the comment: IMHO, we don't need to add the option. We can return the smallest value from the **table** instead of the code below. if len(table) == 1: return table[0][0] [1] https://github.com/python/cpython/blob/master/Lib/statistics.py#L502 -- nosy

[issue35858] Consider adding the option of running shell/console commands inside the REPL

2019-01-31 Thread Windson Yang
Windson Yang added the comment: Hello, jcrmatos. Maybe you can submit your idea to python-ideas mail-list. -- nosy: +Windson Yang ___ Python tracker <https://bugs.python.org/issue35

  1   2   >