[issue42722] Add --debug command line option to unittest to enable post-mortem debugging

2020-12-22 Thread Dominik V.
Change by Dominik V. : -- keywords: +patch pull_requests: +22755 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23900 ___ Python tracker <https://bugs.python.org/issu

[issue42722] Add --debug command line option to unittest to enable post-mortem debugging

2020-12-22 Thread Dominik V.
New submission from Dominik V. : Currently there is no option to use post-mortem debugging via `pdb` on a `unittest` test case which fails due to an exception being leaked. Consider the following example: ``` import unittest def foo(): for x in [1, 2, 'oops', 4]: print(x + 100

[issue42597] Improve documentation of locals() w.r.t. "free variables" vs. global variables

2020-12-08 Thread Dominik V.
New submission from Dominik V. : The documentation of locals() mentions that: > Free variables are returned by locals() when it is called in function blocks > [...] The term "free variable" is defined in the documentation about the execution model (https://docs.python

[issue42345] Equality of typing.Literal depends on the order of arguments

2020-11-13 Thread Dominik V.
New submission from Dominik V. : [PEP 586](https://www.python.org/dev/peps/pep-0586/#shortening-unions-of-literals) specifies that Literal[v1, v2, v3] is equivalent to Union[Literal[v1], Literal[v2], Literal[v3]] Since the equality of Unions doesn't take into account the order

[issue42317] Docs of `typing.get_args`: Mention that due to caching of typing generics the order of arguments for Unions can be different from the one of the returned tuple

2020-11-12 Thread Dominik V.
Dominik V. added the comment: Thinking more about it, I came to realize that it's not the Union that sits at the root of this behavior, but rather the caching performed by generic types in general. So if we consider ``` L1 = List[Union[int, str]] L2 = List[Union[str, int

[issue42317] Docs of `typing.get_args`: Mention that due to caching of typing generics the order of arguments for Unions can be different from the one of the returned tuple

2020-11-12 Thread Dominik V.
Change by Dominik V. : -- keywords: +patch pull_requests: +22150 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/23254 ___ Python tracker <https://bugs.python.org/issu

[issue42317] Docs of `typing.get_args`: Mention that due to caching of typing generics the order of arguments for Unions can be different from the one of the returned tuple

2020-11-10 Thread Dominik V.
New submission from Dominik V. : Due to caching of `__getitem__` for generic types, the order of arguments as returned by `get_args` might be different for Union: ```python >>> from typing import List, Union, get_args >>> get_args(get_args(List[Union[int, str]])[0]) (, ) >

[issue41496] Create public API for typing._eval_type

2020-08-06 Thread Dominik V.
Change by Dominik V. : -- keywords: +patch pull_requests: +20898 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21753 ___ Python tracker <https://bugs.python.org/issu

[issue41496] Create public API for typing._eval_type

2020-08-06 Thread Dominik V.
New submission from Dominik V. : In this [python-ideas thread](https://mail.python.org/archives/list/python-id...@python.org/thread/T6K4DWENPM7LYXSDVYQYDVFEVBMA5K3L/) it was suggested to create a public API for `typing._eval_type` in order to be able to create custom versions

[issue40344] Programming FAQ about "What is the most efficient way to concatenate many strings together?" -- Improving the example

2020-04-20 Thread Dominik V.
Dominik V. added the comment: It was not my intention to disturb the traffic on the bug tracker. My apologies if that caused any trouble. I also thought only people subscribed to the indicated topic (e.g. "Documentation") would receive a notification. The docs pag

[issue40348] Programming FAQ about "What is delegation?": Fix typos

2020-04-20 Thread Dominik V.
New submission from Dominik V. : https://docs.python.org/3/faq/programming.html#what-is-delegation The code example uses `self._outfile` with a single leading underscore, however in the subsequent text it is referred to with a double leading underscore: * [...] calling the underlying `self

[issue40347] Programming FAQ about "How do you remove duplicates from a list?" -- Improve the examples + Mention possible caveats

2020-04-20 Thread Dominik V.
New submission from Dominik V. : https://docs.python.org/3/faq/programming.html#how-do-you-remove-duplicates-from-a-list In the beginning it points to the recipes at https://code.activestate.com/recipes/52560/ which does mention various caveats such as > [...] whether [eleme

[issue40345] Programming FAQ about "How do I iterate over a sequence in reverse order?" should be more precise about `reversed`

2020-04-20 Thread Dominik V.
New submission from Dominik V. : https://docs.python.org/3/faq/programming.html#how-do-i-iterate-over-a-sequence-in-reverse-order It contains the following example: for x in reversed(sequence): ... # do something with x ... With the note: > This won’t touch your origi

[issue40344] Programming FAQ about "What is the most efficient way to concatenate many strings together?" -- Improving the example

2020-04-20 Thread Dominik V.
Dominik V. added the comment: Here's the link to the relevant section: https://docs.python.org/3/faq/programming.html#what-is-the-most-efficient-way-to-concatenate-many-strings-together -- ___ Python tracker <https://bugs.python.org/issue40

[issue40344] Programming FAQ about "What is the most efficient way to concatenate many strings together?" -- Improving the example

2020-04-20 Thread Dominik V.
New submission from Dominik V. : The section mentions the usage of `str.join` and contains the following example: chunks = [] for s in my_strings: chunks.append(s) result = ''.join(chunks) Since `join` accepts any iterable the creation of the `chunks` list in a for loop

[issue40343] Programming FAQ about "How do I call a method defined in a base class from a derived class that overrides it?" should mention the no-arguments-version of `super`

2020-04-20 Thread Dominik V.
New submission from Dominik V. : Right now it contains the following example: class Derived(Base): def meth(self): super(Derived, self).meth() `super()` without arguments is beneficial for multiple reasons, so it should be used in the example. Also the paragraph

[issue40342] Programming FAQ about "How do I apply a method to a sequence of objects?" should include the option of an explicit for-loop

2020-04-20 Thread Dominik V.
New submission from Dominik V. : Right now the question is simply answered with: > result = [obj.method() for obj in mylist] However this is only appropriate if the result of the method is needed (i.e. if it's some kind of transformation). There are many cases where it's not and the met

[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-04-20 Thread Dominik V.
New submission from Dominik V. : The Programming FAQ contains multiple solutions (examples) which it describes as "shouldn't be used". The question is why are these included in the first place? Some of them are complicated in a way that a (new) programmer is unlikely to dis

[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Dominik V.
Dominik V. added the comment: Indeed, thanks for clarifying. It seems I misunderstood the example, and perhaps that calls for a better separation. What about adding > By default, these interpret the number as decimal, so that `int('0144') == > 144` holds true and `int('0x144')`

[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Dominik V.
New submission from Dominik V. : The paragraph about [How do I convert a string to a number?](https://docs.python.org/3/faq/programming.html#how-do-i-convert-a-string-to-a-number) contains the following sentence: > By default, these interpret the number as decimal, so that `int('0