Don't you just love writing this sort of thing :)

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Dec 5 20:20:55 EST 2008


In message <32cf4a79-a6e3-4250-9b5a-1ec80c748618 at j32g2000yqn.googlegroups.com>, Aaron Brady wrote:

> On Dec 5, 4:32 am, Lawrence D'Oliveiro <l... at geek-
> central.gen.new_zealand> wrote:
>
>> The code people write is probably a direct reflection of their thinking
>> processes: For example, slow, plodding, one step at a time, incapable of
>> imaginative leaps, versus those who operate directly on larger patterns
>> at once...
> 
> That distinction operates indirectly on smaller patterns.

Do you find this

    (open, gzip.GzipFile)[Entry.endswith(".gz")](os.path.join(PatchesDir, Entry), "r")

complicated or hard to understand? It's made up of very simple pieces,
combined according to very simple rules, viz:-

A tuple of candidate functions:

    (open, gzip.GzipFile)

A choice from that tuple according to a condition:

    [Entry.endswith(".gz")]

And finally, arguments to pass to the chosen function:

    (os.path.join(PatchesDir, Entry), "r")

See, it's so simple, a child could understand it. A child who isn't burdened
with the preconceptions that seem to afflict some participants in this
noisegroup...



More information about the Python-list mailing list