r/learnpython • • Oct 13 '15

Entire Python Language in a Single Image!

Check this link for the image. Take a large print out!

27 Upvotes

23 comments sorted by

View all comments

2

u/cdcformatc Oct 13 '15

Does python have type casting? int('42') isn't a cast.

2

u/raylu Oct 13 '15

It's commonly referred to as a cast.

3

u/cdcformatc Oct 13 '15

I've only heard it referred to as a conversion. A cast doesn't modify the value, or change it any way, it just tells the compiler to treat the value at that memory location as a different type. str(False) changes the value to something else.

1

u/JohnnyJordaan Oct 14 '15

Indeed and thus casting is something impossible to do in python as you work with objects for all data types. A castable object would have to guarantee its memory pattern would be compatible for usaga as another object, I don't see that happening.