This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unexpected difference between map and list
Type: behavior Stage: resolved
Components: Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Pierre van de Laar
Priority: normal Keywords:

Created on 2020-11-11 08:54 by Pierre van de Laar, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bug.zip Pierre van de Laar, 2020-11-11 08:54
tests.zip Pierre van de Laar, 2020-11-11 09:03
Messages (3)
msg380742 - (view) Author: Pierre van de Laar (Pierre van de Laar) Date: 2020-11-11 08:54
On windows, with python 3.9, with unittests,

My test case fails when I use the following lines of code
```
result = map(lambda x: self.substitute_in_expression(x),
                     sequence.sequence)
```
It works fine with
```
result = list()
for x in sequence.sequence:
     result.append(self.substitute_in_expression(x))
```

Note that result is used as input for an inherited class instantiation:
```
        sequence_type = type(sequence)
        return sequence_type(result)
```
The classes are constructed using the dataclass decorator!


I have unfortunately not have time to make a small reproducer.
So I just send the whole project.
msg380743 - (view) Author: Pierre van de Laar (Pierre van de Laar) Date: 2020-11-11 09:03
Zip didn't contain the test cases from the tests directory (sorry for that)
msg380745 - (view) Author: Pierre van de Laar (Pierre van de Laar) Date: 2020-11-11 10:23
Not a bug: tuple is an iterator but an iterator is not a tuple.
Yet iterators are often accepted during initialization...
History
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86486
2020-11-11 10:23:30Pierre van de Laarsetstatus: open -> closed
resolution: not a bug
messages: + msg380745

stage: resolved
2020-11-11 09:03:00Pierre van de Laarsetfiles: + tests.zip

messages: + msg380743
2020-11-11 08:54:28Pierre van de Laarcreate