"Hugo Arts" <hugo.yo...@gmail.com> wrote

Yes. A cast or typecast means converting some data to a different
type, like converting floats to integers, strings to integers,

The term cast can be misleading however since in some
languages - those decended from C it means treating a piece
of data as if it were another type, which is different to converting it.

For example in C:

char c = '7';
int x = (int)c; //this is type casting in C - it means treat c as an integer
int y = atoi(c);   // this is type conversion in C

x and y are not the same. x is effectively ord('7') whereas y is 7.
But in C only the first is referred to as a cast.

Not directly relevant in a Python thread but it can cause confusion
if newbies see references to casting in the C sense and think
it means type conversion.

Just feeling picky,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/





_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to