Specifing arguments type for a function

bruno at modulix onurb at xiludom.gro
Tue Jun 20 08:04:02 EDT 2006


K.S.Sreeram wrote:
> bruno at modulix wrote:
> 
>>  if type(arg) is type([]):
> 
> 
> Just a tiny nitpick....
> You can just use 'list' instead of 'type([])'

I know. Note that I wrote "*A* right way to write this", not "*The*
right way..."

And FWIW, you could also use arg.__class__ instead of type(arg).

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list