New submission from A.M. Kuchling <li...@amk.ca>:

The examples of set operations in 
http://docs.python.org/dev/library/stdtypes#dictionary-view-objects don't work 
in the current 2.7 trunk:

-> ./python.exe
Python 2.7b1+ (trunk:80084:80085M, Apr 14 2010, 21:17:06) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}
>>> keys = dishes.viewkeys()
>>> keys & {'eggs', 'bacon', 'salad'}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for &: 'dict_keys' and 'set'
>>> keys | {'eggs'}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'dict_keys' and 'set'

Is this a documentation bug, and set operations are only supported in 3.x?  Or 
does the code need to be fixed?

(Assigned to Alexandre, since he committed the backport patch; please feel free 
to reassign.  Marking as release blocker; if it's a documentation bug, we can 
lower the priority.)

----------
assignee: alexandre.vassalotti
messages: 103166
nosy: akuchling, alexandre.vassalotti
priority: release blocker
severity: normal
status: open
title: Set operations don't work for dictionary views
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8404>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to