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.

Author akuchling
Recipients akuchling, alexandre.vassalotti
Date 2010-04-15.01:23:44
SpamBayes Score 5.3346216e-14
Marked as misclassified No
Message-id <1271294628.24.0.991589115807.issue8404@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2010-04-15 01:23:48akuchlingsetrecipients: + akuchling, alexandre.vassalotti
2010-04-15 01:23:48akuchlingsetmessageid: <1271294628.24.0.991589115807.issue8404@psf.upfronthosting.co.za>
2010-04-15 01:23:46akuchlinglinkissue8404 messages
2010-04-15 01:23:44akuchlingcreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.