Re: Populating a dictionary, fast



DouhetSukd <DouhetSukd@xxxxxxxxx> writes:

Ah, well, just noticed Ben's suggested this already. Mind you, his
code, while correct in intent, does look a bit fishy (missing those
square brackets)

By "missing those square brackets", what would be a list comprehension
(allocating an entire list in memory at once before proceeding)
becomes a generator expression (generating results from the sequence
only as needed).

Enter 'python "generator expression"' into your favourite search
engine to find out more.

--
\ "What I resent is that the range of your vision should be the |
`\ limit of my action." -- Henry James |
_o__) |
Ben Finney
.



Relevant Pages

  • Re: Populating a dictionary, fast
    ... code, while correct in intent, does look a bit fishy (missing those ... square brackets), so don't dismiss it just because you had trouble ...
    (comp.lang.python)
  • Re: puzzling results from dlookup
    ... Since the field name begins with a number, use square brackets around the ... Year is a VBA function, and it will confuse Access if you use it as a ... thinks is a missing operator. ... Criteria string is correctly formed. ...
    (microsoft.public.access.formscoding)
  • Re: define "generator" (glossary bug?)
    ... >>> and has used instead the definition for 'generator function', ... >>> which term is missing from the glossary. ... America's vaunted "free press" notwithstanding, ... -- Jim Thornton ...
    (comp.lang.python)
  • About 1.8.7 Array#map! without a block
    ... with e.next to change the value, say, multiplying by 2 as on the first ... case and have a array on the end? ... - Why I get a Generator on "a" elements when I just call e.next? ... cause it's what I'm missing to use with next, ...
    (comp.lang.ruby)
  • [PATCH 08/13] checkpatch: complex macros checks miss square brackets
    ... We are missing 'simple' values which include square brackets. ... Refactor ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)