Zip Question

Stephen Hansen apt.shansen at
Fri Oct 9 19:37:38 CEST 2009

Changing the line:
>  subtypes = dict(zip(sstp, sst))
> to:
> subtypes = dict(zip(sst, sstp))
> as I believe Stephen misread it to be causes the zip operation to return:
> [('doctors', 'prescriptions'), ('patient', 'prescriptions')]
> and thus the dict will contain:
> {'patient': 'prescriptions', 'doctors': 'prescriptions'}
Whoops! You're absolutely right. I totally flipped the options to zip in my
head when eyeing it. I suppose I'm suffering from late-onset dyslexia. Ahem.

Yeah, I think the arguments to zip() were probably just flipped in Victor's
code. Unless he wants a result different then what I assume is expected. I
assume he's expecting {"doctors": "prescriptions", "patient":
"prescriptions"}. If instead its something more like {"prescriptions":
["doctors", "patient"]} then zip() isn't how to accomplish it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list