[New-bugs-announce] [issue1967] Backport dictviews to 2.6

Thomas Wouters report at bugs.python.org
Tue Jan 29 23:39:05 CET 2008

New submission from Thomas Wouters:

Patch to backport dictviews to trunk. Consists of some trickery:

 - new 'viewkeys', 'viewvalues' and 'viewitems' methods of dicts,
returning exactly what 'keys', 'values' and 'items' return in 3.0: three
new types defined in dictobject.c
 - a future import (dictviews) that changes which opcodes are generated
for (some) attribute access
 - special opcodes for getting and setting 'keys', 'values' and 'items'
attributes from an object. These opcodes do nothing special unless a
future import is in effect in the calling code block *and* the type they
are called on is a dict subclass, in which case they translate 'keys',
'values' and 'items' to 'viewkeys', 'viewvalues' and 'viewitems'.
 - similar specialcasing in getattr() and setattr()

components: Interpreter Core
files: dictviews_backport.diff
keywords: patch
messages: 61834
nosy: twouters
severity: normal
status: open
title: Backport dictviews to 2.6
versions: Python 2.6
Added file: http://bugs.python.org/file9320/dictviews_backport.diff

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list