[gull] python2.5 et type(x)

Philippe Strauss philou at philou.ch
Wed Jul 30 17:18:15 CEST 2008


Hello,

J'ai un script datant d'un bail que je dépoussière.
le seul truc poussièreux en fait, c'est ceci:

if type(dict[k]) == types.DictType:

cela fonctionnait avec python2.2 ou 2.3, plus avec 2.5.
J'ai essayé de remplacer avec ceci (d'après l'excellente URL trouvée à l'instant:
http://rgruet.free.fr/PQR25/PQR2.5.html)

if isinstance(dict[k], types.DictType):

marche pô.

if isinstance(dict[k], dict):

marche pô non plus. embêtant.

qqun sait pourquoi et la bonne manière de faire?
merci!

-- 
Philippe Strauss
http://philou.ch



More information about the gull mailing list