[Python-ideas] "on" statement

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Apr 4 11:35:52 CEST 2010


Bruce Leban wrote:

>     foo is in bar     = hasattr(foo,bar)
>     foo is not in bar = not hasattr(foo,bar)
>     foo is class bar = isinstance(foo,bar)
>     foo is from bar  = issubclass(foo,bar)
>     foo is with bar  = type(foo) == type(bar)

+1. Also we must absolutely have

   foo is totally bar

for those *$&@*&(*@& moments we all experience while coding.

-- 
Greg



More information about the Python-ideas mailing list