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
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
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
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
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
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
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])
(, )
>
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
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
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
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
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
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
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
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
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
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
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
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')`
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
20 matches
Mail list logo