Hello list,
I've got a question partially related to this thread.

* Gregor Lingl <[EMAIL PROTECTED]>, [2006-05-03  0:24 +0200]:
>  v=<some numeric value>
>  if isinstance(v, int) or isinstance(v, float):
>       <block>

I wonder which is the recommended way to check the type of a value.

In other words, what should I choose between:
    isinstance(v, int)
    type(v) is int
    v.__class__ is int

There's simply more than one way to do it or some of them are
discouraged?

I've been told on #python that .__class__ is probably the worst one, but
without precise motivation, just as a personal opinion.

ciao,
    ema

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to