[Python-de] types.SetType

"Martin v. Löwis" martin at v.loewis.de
So Feb 11 10:27:01 CET 2007


Dinu Gherman schrieb:
> Das ist nicht der Punkt. Das Modul types gibt es eben darum,
> damit ich so etwas nicht immer schreiben muss (wie bei den
> leidigen Tests in der Art if type(obj) == type(""): ...).

Und ein dritter Versuch. Bei neuem Code solltest Du *weder*

if type(obj) == type(""):

schreiben, noch

if type(obj) == types.StringType:

*sondern*

if type(obj) == str

(u.U. auch

if isinstance(obj, str):

)

Ciao,
Martin




Mehr Informationen über die Mailingliste python-de