[issue46614] Add option to output UTC datetimes as "Z" in `.isoformat()`

2022-04-03 Thread Matt Wozniski
Matt Wozniski added the comment: > My main hesitation with this name is that I suspect users may think that > `use_utc_designator` means that they *unconditionally* want to use `Z` — > without reading the documentation (which we can assume 99% of users won't do) I was thinking alon

[issue46614] Add option to output UTC datetimes as "Z" in `.isoformat()`

2022-03-21 Thread Matt Wozniski
Change by Matt Wozniski : -- keywords: +patch pull_requests: +30131 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/32041 ___ Python tracker <https://bugs.python.org/issu

[issue39829] __len__ called twice in the list() constructor

2022-03-07 Thread Matt Wozniski
Matt Wozniski added the comment: Pardon me for necroing an old issue, but someone pointed out the surprising behavior of `__len__` being called twice by `list(iterable)`, and it caught my curiosity. https://github.com/python/cpython/commit/372d705d958964289d762953d0a61622755f5386 made

[issue46614] Add option to output UTC datetimes as "Z" in `.isoformat()`

2022-02-11 Thread Matt Wozniski
Matt Wozniski added the comment: > I feel like "If the offset is 00:00, use Z" is the wrong rule to use > conceptually This is a really good point that I hadn't considered: `+00:00` and `Z` are semantically different, and just because a datetime has a UTC offset of 0 doesn'

[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2022-01-26 Thread Matt Wozniski
Matt Wozniski added the comment: I agree with Brett. Adding `allow_z` (or perhaps `compact` or `use_utc_designator` if we're bikeshedding) as an optional keyword only argument to `.isoformat()` would allow us to keep the explanation that what `.fromisoformat()` can parse is exactly what

[issue45982] Bug in Error messages

2021-12-04 Thread Matt Wozniski
Matt Wozniski added the comment: > Syntactically, this could be many possible errors: missing comma, missing > period, missing parens, missing brackets, etc. Syntactically, it cannot be a missing comma. Adding the comma is a syntax error. $ python3 -c 'if datetime.now(),strftime(...)

[issue45675] pkgutil.get_data() doesn't add subpackages to parent packages when importing

2021-11-29 Thread Matt Wozniski
Matt Wozniski added the comment: I wondered if it would be backwards compatible to make `pkgutil.get_data()` delegate to `importlib.resources.read_binary()`. It isn't, because `pkgutil.get_data()` accepts a relative path for the resource, and `importlib.resources.read_binary()` accepts only

[issue45675] pkgutil.get_data() doesn't add subpackages to parent packages when importing

2021-10-29 Thread Matt Wozniski
Matt Wozniski added the comment: The original case where I encountered this was with a namespace package, but the behavior appears to be the same for a subpackage of a regular package. -- title: pkgutil.get_data() doesn't add subpackages to namespaces when importing

[issue45675] pkgutil.get_data() doesn't add subpackages to namespaces when importing

2021-10-29 Thread Matt Wozniski
New submission from Matt Wozniski : If a module hasn't yet been imported, `pkgutil.get_data(pkg_name, data_file)` will import it, but when it does, it doesn't add the submodule to its parent package when the parent package is a PEP 420 implicit namespace package. ``` $ mkdir -p namespace

[issue45325] Allow "p" in Py_BuildValue

2021-09-30 Thread Matt Wozniski
Matt Wozniski added the comment: > "!value" or "!!value" also has the issue if I understood correctly. No, just as "value != 0" is an int, so is "!value". -- ___ Python t

[issue45325] Allow "p" in Py_BuildValue

2021-09-29 Thread Matt Wozniski
Matt Wozniski added the comment: The leftmost argument of the ternary is an int for every example that Victor and I found in the stdlib, so no casting would be required in any of these cases. -- ___ Python tracker <https://bugs.python.

[issue45325] Allow "p" in Py_BuildValue

2021-09-29 Thread Matt Wozniski
Matt Wozniski added the comment: I spotted three other uses in the stdlib: Modules/_io/_iomodule.c raw = PyObject_CallFunction(RawIO_class, "OsOO", path_or_fd, rawmode, closefd ? Py_True

[issue45325] Allow "p" in Py_BuildValue

2021-09-29 Thread Matt Wozniski
Matt Wozniski added the comment: > but there is a catch -- the arguments should be a C int Or a type that promotes to int. If you pass a C short or char, or a C++ bool, it is implicitly promoted to int. > so you will need to write "expr ? 1 : 0" Or alternatively &

[issue17140] Document multiprocessing.pool.ThreadPool

2020-12-16 Thread Matt Wozniski
Change by Matt Wozniski : -- keywords: +patch nosy: +godlygeek nosy_count: 7.0 -> 8.0 pull_requests: +22673 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/23812 ___ Python tracker <https://bugs.p

[issue38894] Path.glob() sometimes misses files that match

2020-03-06 Thread Matt Wozniski
Matt Wozniski added the comment: A simple test case for this issue: ~>mkdir tmp ~>cd tmp tmp>touch 1.txt tmp>ln -s subdir/file 2.txt tmp>touch 3.txt tmp>ls -l total 0 -rw-rw-r-- 1 mwoznisk general 0 Mar 6 14:52 1.txt lrwxrwxrwx 1 mwoznisk general 11 Mar 6 14:52 2.txt -&g