[Tutor] parsing configuration files

Lloyd Kvam pythontutor at venix.com
Mon Dec 22 21:56:13 EST 2003


Daniel Ehrenberg wrote:
> Danny Yoo wrote:
>>There's a subtle type error going on, and it has to
>>do with 'data'.
> 
> 
> Hmm. I guess this is one of the disadvantages of
> Python's relatively weak typing.

I don't think it is weak typing so much as the fact that a string, list
and tuple are all sequences.  (Unless this broadness of sequence
is what you mean by weak typing.)  I usually create this kind of bug
when I pass a single fieldname to a function that expects a list of fieldnames.
The function will happily attempt to process a sequence of one character names
unless I put in a check to catch strings and turn them into single item lists.

On balance, I still like the ease of slicing strings that comes from
including strings in the "sequence family".

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582




More information about the Tutor mailing list