[New-bugs-announce] [issue40760] Dictionary comprehension using older division behavior

Amol Sharma report at bugs.python.org
Sun May 24 17:36:37 EDT 2020


New submission from Amol Sharma <guesswhoas at gmail.com>:

Using comprehension to divide all the values in a dictionary like in the following results in integer division in 3.8.

some_dict = {k: v/5 for k, v in some_dict.items()}

This was solved by changing 5 to 5.0, reflecting behavior from python2. I would have expected to have the use the // operator for integer division.

Please correct me if this is expected behavior!

----------
messages: 369833
nosy: Amol Sharma
priority: normal
severity: normal
status: open
title: Dictionary comprehension using older division behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40760>
_______________________________________


More information about the New-bugs-announce mailing list