[issue22801] collections.Counter, when empty, doesn't raise an error with = when other is an incompatible type

2015-03-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I see no reason pure python code to have to detect and report such oddities.
Closing as not worth it.

--
resolution:  - rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22801] collections.Counter, when empty, doesn't raise an error with = when other is an incompatible type

2015-03-02 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage: patch review - test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22801] collections.Counter, when empty, doesn't raise an error with = when other is an incompatible type

2015-03-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Additional check is not for free.

$ ./python -m timeit -s from collections import Counter; a = Counter(); b = 
Counter(range(10)) -- a = b

Unpatched: 10 loops, best of 3: 8.4 usec per loop
Patched:   10 loops, best of 3: 9.7 usec per loop

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22801] collections.Counter, when empty, doesn't raise an error with = when other is an incompatible type

2014-11-05 Thread Ethan Furman

New submission from Ethan Furman:

test script:
---
from collections import Counter
empty_counter = Counter()
counter = Counter('abbc')
empty_counter = 5
counter = 5
---

results:
---
Traceback (most recent call last):
  File blah.py, line 5, in module
counter = 5
  File /home/ethan/source/python/issue22778/Lib/collections/__init__.py, line 
780, in __iand__
other_count = other[elem]
TypeError: 'int' object is not subscriptable


As can be seen, the error does not show up when the Counter is empty, which 
could lead to hard to diagnose bugs.

--
assignee: rhettinger
files: issue22778.stoneleaf.01.patch
keywords: patch
messages: 230699
nosy: ethan.furman, rhettinger
priority: normal
severity: normal
stage: patch review
status: open
title: collections.Counter, when empty, doesn't raise an error with = when 
other is an incompatible type
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37136/issue22778.stoneleaf.01.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22801] collections.Counter, when empty, doesn't raise an error with = when other is an incompatible type

2014-11-05 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


Removed file: http://bugs.python.org/file37136/issue22778.stoneleaf.01.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22801] collections.Counter, when empty, doesn't raise an error with = when other is an incompatible type

2014-11-05 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


Added file: http://bugs.python.org/file37137/issue22778.stoneleaf.01.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com