File tests in Python

Aahz Maruch aahz at panix.com
Fri Oct 13 14:23:45 EDT 2000


In article <k0nwvfc6255.fsf at dhcp-49138.phys.ntnu.no>,
Joakim Hove  <hove at phys.ntnu.no> wrote:
>Following up on my own post:
>
>> [...]  Writing 
>> 
>>    List = [1,2,["List","in","List"]]
>>  
>> in Python is just the way it _should_ be, really nice!
>
>In this case List[0] and List[1] are simple scalars - whearas List[2]
>is a new list (or is this a "unPythonlike" way of thinking ??). Is
>there a way of testing this, i.e.

import types
if type(foo) == types.ListType:
  ...
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Isn't it interesting that the same people who laugh at science fiction
listen to weather forecasts and economists?" -- Kelvin Throop III



More information about the Python-list mailing list