Dictionary Comprehension
Michael Hudson
mwh at python.net
Tue Mar 19 08:00:50 EST 2002
Dale Strickland-Clark <dale at riverhall.NOTHANKS.co.uk> writes:
> What ever happened to the idea of dictionary comprehension discussed
> (well, mentioned in a timid whisper) in the middle of last year?
>
> I'm doing some dictionary work right now where I keep seeing all sorts
> of neat applications for the idea.
>
> I'd really like a concise way to work on a filtered subset of a
> dictionary.
It got made into a PEP:
http://python.sourceforge.net/peps/pep-0274.html
The "Parade of the PEPs" says:
PEP 274 - Dict Comprehensions - Warsaw
If we were to adopt dict comprehensions, this PEP says everything
that needs to be said. But I don't even want to think about this
for Python 2.3; I think it's way too minor a feature.
This would be a lot easier to adopt if there was a working
implementation in patch form.
Sometimes it would be nice if things like this could be defined
using hygienic macros or some other kind of preprocessor or
whatever, and imported from a module, rather than requiring major
hacking in the parser, the bytecode compiler, and the virtual
machine.
Cheers,
M.
--
The above comment may be extremely inflamatory. For your
protection, it has been rot13'd twice.
-- the signature of "JWhitlock" on slashdot
More information about the Python-list
mailing list