Nice way to cast a homogeneous tuple

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Jul 28 10:11:22 EDT 2010


wheres pythonmonks a écrit :
> Thanks ... I thought int was a type-cast (like in C++) so I assumed I
> couldn't reference it.

Python has no C/C++ like "type-cast". "int" is the builtin integer type, 
and instanciating an object in Python is done by calling it's type. 
Remember that in Python, everything (at least everything you can bind to 
a name) is an object (including functions, types etc), and that 
functions are just one kind of callable objects (types - aka "classes" 
-, methods and a few other builtin objects are callable too, and you can 
of course define your own callable type).

HTH



More information about the Python-list mailing list