Last active
May 23, 2020 16:08
-
-
Save ctb/38e70e1cf2ff4ad1c0add1ec6a24cd39 to your computer and use it in GitHub Desktop.
wth?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in a Jupyter notebook, after %pylab inline | |
# so - not a Python bug, but a pylab/numpy thing | |
c = collections.Counter() | |
c['a'] = 5 | |
c['b'] = 3 | |
print('XXX:', sum(c.values())) | |
print('YYY:', sum([ x for x in c.values() ])) | |
# gives: | |
# XXX: dict_values([5, 3]) | |
# YYY: 8 |
huh! so it does in my conda install. I feel like I tested this in a few different versions... argh
argh now I can't replicate it :). had a whole discussion on lab slack about this.
others replicated it.
etc.
maybe it was just fixed in a more recent version.
wait no, found the notebook I first encountered it in, using same conda environment (py 3.7.6). maybe an import order thing? ...ah-hah.
%pylab inline
is causing it.
Nice catch!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works as expected with Python 3.7.6