[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets
Francis MB added the comment: Good options itemization! >> This would give us a clean, fast API with no flags: >> mode(Iterable) -> scalar >> multimode(Iterable) -> list [...] >> For any of those options, we should still add a separate multimode() >> function. [..] >> * Add a Deprecation warning to the current behavior of mode() when it >> finds multimodal data. Then change the behavior in Python 3.9. This >> is uncomfortable for one release, but does get us to the cleanest API >> and best performance. LGTM upto 3.9, shouldn't be "mode" at some point be replaced by "multimode" ? -- ___ Python tracker <https://bugs.python.org/issue35892> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets
Francis MB added the comment: >> [...] This keeps the signature simple (Iterable -> Scalar). [...] >> >> Categorical, binned, or ordinal data: >> >> mode(data: Iterable, *, first_tie=False) -> object >> multimode(data: Iterable) -> List[object] This seems reasonable to me due legacy (although I really thing that multimode is just the real thing :-) ) >> Continuous data: >> mode(data: Iterable[Real]) -> Real What should return in that case: E.g.: mode([42.0, 42.0, 42.0, 1.0, 1.0, 1.0]) ? 42.0 ? or 1.0 ? or [42.0, 1.0] ? or do I have misunderstood something ? Thanks! -- ___ Python tracker <https://bugs.python.org/issue35892> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets
Francis MB added the comment: Good point Raymond! Only a minor observation on the packages API: [1] SciPy: scipy.stats.mode(a, axis=0, nan_policy='propagate') "Returns an array of the modal (most common) **value** in the passed array." --> Here it claims to return just ONE value And use of different policies on parameters : nan_policy : {‘propagate’, ‘raise’, ‘omit’}, optional Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default is ‘propagate’. Equivalent one could say 'multivalue_policy' [2] Matlab: Mode: "Most frequent **values** in array" ...returns the sample mode of A, which is the most frequently occurring *value* in A" IMHO it seems inconsistent *values* vs. *value* (or a doc-bug ?). An a question: Does it that mean that mode in that case really should potentially return an array of values, e.g. all the values with equal frequency? In that case the user has the chance to get the first, the last or just all, ... [1] https://docs.scipy.org/doc/scipy-0.19.1/reference/generated/scipy.stats.mode.html [2] https://la.mathworks.com/help/matlab/ref/mode.html -- ___ Python tracker <https://bugs.python.org/issue35892> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets
Francis MB added the comment: >> There may be better names for the flag. "tie_goes_to_first_encountered" >> seemed a bit long though ;-) Could it may be an alternative to set the mode tie case in a form like: def mode(seq, *, case=CHOOSE_FIRST): [...] (or TIE_CHOOSE_FIRST, ...) where CHOOSE_FIRST is an enum ? Thanks! -- nosy: +francismb ___ Python tracker <https://bugs.python.org/issue35892> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27766] Add ChaCha20 Poly1305 to SSL ciphers
Francis MB added the comment: Documentation cosmetic: # * Prefer ECDHE over DHE for better performance # * Prefer any AES-GCM over any AES-CBC for better performance and security +# * Prefer any AES-GCM over any AES-CBC for better performance and security The patch seems to be adding the same preference comment? or did you mean other preference? -- nosy: +francismb ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27766> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26219] implement per-opcode cache in ceval
Francis MB added the comment: >From the two checks on Python/compile.c: + expr_ty meth = e->v.Call.func; [...] +/* Check [...] that + the call doesn't have keyword parameters. */ [...] +/* Check that there are no *varargs types of arguments. */ [...] I just wonder how many times those kind of checks/guards are done on the whole Cpython code base (the second one seems expensive). (Naive Idea): Wouldn't be some kind of fast function description (e.g. bit flags or 'e->v.Call.func.desc') generally helpful? The function description could have: 'has_keywords' or 'has_varargs', ... Thanks in advance! -- nosy: +francismb ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12018] No tests for ntpath.samefile, ntpath.sameopenfile
Francis MB added the comment: Can this issue be closed? IMHO it's not clear what still needs to be done. The patch seems to be there already. Thanks in advance! -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11145] '%o' % user-defined instance
Francis MB added the comment: I'm not sure if it's relevant but in the patch you changed previous 'assert(check)' with 'if (not check) goto error'. But the new patch code adds 'assert(len == 0 || Py_REFCNT(r1) == 1);' Just curious, is there a reason why couldn't be in the same way? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11145 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7726] Remove required metadata warnings for sdist
Francis MB added the comment: AFAICS, this is an enhancement issue for the currently in maintenance branches 2.7 and 3.2. Does this still applies to 3.5? (otherwise this issue should/could be closed). -- nosy: +francismb type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7726 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10764] sysconfig and alternative implementations
Francis MB added the comment: Is this issue superseded and duplicated as stated in the history? Thanks in advance! -- nosy: +francismb type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10764 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11145] '%o' % user-defined instance
Francis MB added the comment: Just updating the type to 'behavior'. I can still reproduce this issue: $ python2.7 Python 2.7.8 (default, Sep 9 2014, 22:08:43) [GCC 4.9.1] on linux2 Type help, copyright, credits or license for more information. class Y(long): ... def __oct__(self): ... return 'abc' ... '%o' % Y() Traceback (most recent call last): File stdin, line 1, in module SystemError: ../Objects/stringobject.c:4045: bad argument to internal function -- nosy: +francismb type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11145 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11145] '%o' % user-defined instance
Francis MB added the comment: Do have I overseen the patch? or may be doing something wrong? or isn't anything uploaded? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11145 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8481] doc: ctypes no need to explicitly allocate writable memory with Structure
Changes by Francis MB franci...@email.de: -- type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11582] Boilerplate code replaced in Python/ceval.c
Changes by Francis MB franci...@email.de: -- type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11582 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6396] '' % object() raises TypeError
Changes by Francis MB franci...@email.de: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6396 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir
Francis MB added the comment: I have to thank for your time, David! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir
Francis MB added the comment: Why is test.support.EnvironmentVarGuard preferable over distutils.test.support.EnvironGuard (with this one I'm not getting the warnings below)? If I change the patch to (not so different (?) as in other tests using EnvironmentVarGuard): $hg diff diff -r 2b212a8186e0 Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py Mon Sep 29 11:25:00 2014 -0400 +++ b/Lib/distutils/tests/test_bdist_rpm.py Mon Sep 29 21:11:25 2014 +0200 @@ -5,7 +5,7 @@ import os import tempfile import shutil -from test.support import run_unittest +from test.support import run_unittest, EnvironmentVarGuard from distutils.core import Distribution from distutils.command.bdist_rpm import bdist_rpm @@ -36,8 +36,11 @@ super(BuildRpmTestCase, self).setUp() self.old_location = os.getcwd() self.old_sys_argv = sys.argv, sys.argv[:] +self.env = EnvironmentVarGuard() def tearDown(self): +self.env.__exit__() +del self.env os.chdir(self.old_location) sys.argv = self.old_sys_argv[0] sys.argv[:] = self.old_sys_argv[1] @@ -54,6 +57,7 @@ def test_quiet(self): # let's create a package tmp_dir = self.mkdtemp() +self.env['HOME'] = tmp_dir # to confine dir '.rpmdb' creation pkg_dir = os.path.join(tmp_dir, 'foo') os.mkdir(pkg_dir) self.write_file((pkg_dir, 'setup.py'), SETUP_PY) @@ -96,6 +100,7 @@ def test_no_optimize_flag(self): # let's create a package that brakes bdist_rpm tmp_dir = self.mkdtemp() +self.env['HOME'] = tmp_dir # to confine dir '.rpmdb' creation pkg_dir = os.path.join(tmp_dir, 'foo') os.mkdir(pkg_dir) self.write_file((pkg_dir, 'setup.py'), SETUP_PY) I get the message: [102/390] test_distutils Warning -- threading._dangling was modified by test_distutils Using EnvironmentVarGuard as context manager gives the same warning. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir
Francis MB added the comment: No problem, but is the, 3 lines, patch ok? what are the next steps, if yes? Shouldn't be the issue status now 'patch review' or similar? Thanks in advance! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9313] distutils error on MSVC older than 8
Francis MB added the comment: Hi Éric, are the changes to distutils2 applied? could the issue be closed (has resolution:fixed) or is something to be done? -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9313 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9313] distutils error on MSVC older than 8
Francis MB added the comment: Distutils2 is dead. I wasn't aware of that and I'm sorry for that. In that case that issue can IMHO be closed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9313 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir
New submission from Francis MB: Running the test suite or 'test_distutils' triggers the creation of the directory '.rpmdb'. I noticed that because somehow that directory was bad formed and got errors while running the test suite: error: db5 error(-30969) from dbenv-open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch error: cannot open Packages index using db5 - (-30969) error: cannot open Packages database in /home/ci/.rpmdb error: db5 error(-30969) from dbenv-open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch error: cannot open Packages index using db5 - (-30969) error: cannot open Packages database in /home/ci/.rpmdb After moving that directory and running the suite again the directory reappeared (but that time, and since then, no errors occurred). It seems that 'test_distutils.test_bdist_rpm' triggers that behavior. This seems to be due 'rpm' having it so configured [1]. In my case: $ rpm -v --showrc | grep '.rpmdb' -14: _dbpath%(bash -c 'echo ~/.rpmdb') Here is a patch that confines the creation of this directory to the temporal test directory. Regards, francis [1] https://bugs.launchpad.net/rpm/+bug/1069350 -- components: Distutils, Tests files: confine_hidden_rpmdb_dir_creation.patch keywords: patch messages: 22 nosy: dstufft, eric.araujo, francismb priority: normal severity: normal status: open title: 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file36750/confine_hidden_rpmdb_dir_creation.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6623] Lib/ftplib.py Netrc class should be removed.
Francis MB added the comment: I've downloaded 'remove_Netrc_class2.patch' and passes the test suite, the examples on the documentation run ok and manually from the command line: $hg tip changeset: 92597:e29866cb6b98 tag: tip parent: 92594:d43d4d4ebf2c parent: 92596:54987723de99 ... $ hg status M Lib/ftplib.py M Lib/test/test_ftplib.py ? Modules/_testembed $ ./python -m ftplib -d ftp.debian.org -ddebian *cmd* 'USER anonymous' *resp* '331 Please specify the password.' *cmd* 'PASS *' *resp* '230 Login successful.' *cmd* 'CWD debian' *resp* '250 Directory successfully changed.' *cmd* 'QUIT' *resp* '221 Goodbye.' My test '.netrc' file was: $ cat ~/.netrc machine ftp.debian.org login anonymous password anonymous The patch also looks good for me. -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6623 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20135] FAQ need list mutation answers
Francis MB added the comment: A) On the example: +Also note that some operations (e.g. ``y.append(10)``/``y += [10]`` or +``y.sort()``) mutate are you saying: 1) y.append(10) divided by y += [10] or 2) y.append(10) and y += [10] I don't want to split hairs but reading it fast confused me a bit B) The paragraph: + etc.), we can use some specific operations to mutate it and all the variables + that refer to it will see + the change; Couldn't be (one newline less): + etc.), we can use some specific operations to mutate it and all the variables + that refer to it will see the change; -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20135 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19838] test.test_pathlib.PosixPathTest.test_touch_common fails on FreeBSD with ZFS
Francis MB added the comment: What we have found out so far is that during file creation the resolution of the timestamp is higher then at the touch attempt when a file exists. Could it help to create 2 files (file 1, wait a bit, file 2) and then do the checks only with file 1? -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2091] file accepts 'rU+' as a mode
Francis MB added the comment: On the other hand, the documentation *does* mention that 'U' is for backwards compatibility and shouldn't be used with new code. Shouldn't be some deprecation warning somewhere? -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2091 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16040] nntplib: unlimited readline() from connection
Francis MB added the comment: Just a small detail on the patches, they seem to have a typo (lenght vs. length) on the line: reading arbitrary lenght lines. RFC 3977 limits NNTP line length to -- nosy: +francismb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16040 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com