Why would I use inspect.isclass()?

Steve Holden steve at holdenweb.com
Thu Dec 30 12:45:10 EST 2004


It's me wrote (top posting as usual, but we won't make a big song and 
dance about that[1] :-):

> Steve,
> 
> You are correct that I worry too much about types.   It's *really* hard not
> to - having so many years of C in my head (and I am not exactly a
> programmer).
> 
> I realize that "if you don't understand duck typing, you don't really
> understand Python" - and that's why I am struggling to learn about this.
> 
Well the basic idea is "treat what you've been passed as though it is 
the type you wanted". When it's only you writing the code that's likely 
going to be the case. When it's others, you have to be a little more 
careful to catch the exceptions (except when you don;t bother, in which 
case the users will have to understand the tracebacks).

> It's hard to writing a routine and not thinking what kind of parameters will
> be passed down from above.  In the old days, we go out of the way to do that
> so programs don't fail in mysterous ways.
> 
Don't worry. Soon you will understand the Way of Python, and all will 
become clear :-)

probably-won't-stop-you-top-posting-though-ly y'rs  - steve

[1] OK, so I lied.
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list