Checking if a variable is a dictionary

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Mar 6 09:24:29 EST 2008


Guillermo wrote:

> I'm just designing the algorithm, but I think Python dictionaries
> can hold any kind of sequence?

(Watch out, dicts are no sequence types.)

I recommend relying duck typing as long as it's feasible. I. e. if
it can be subscripted like a dict, it is a dict. If this makes
problems, use the type({}) approach.

Regards,


Björn

-- 
BOFH excuse #56:

Electricians made popcorn in the power supply




More information about the Python-list mailing list