Direct casting types don't have to be strictly related It comes in all types of flavors Usually a new object is created Copy and information might be lost Change reference type, otherwise throws exception. How do i cast an int to an enum in c++
Enum test { a, b } How do i convert a to type test::a? Vb actually has 2 notions of casting Clr style casting lexical casting clr style casting is what a c# user is more familiar with This uses the clr type system and conversions in order to perform the cast Vb has directcast and trycast equivalent to the c# cast and as operator respectively
Do you understand the concept of casting Casting is the process of type conversion, which is in java very common because its a statically typed language Casting has sense only for a variable (= chunk of memory whose content can change) there are no variables whose content can change, in python There are only objects, that aren't contained in something They have per se existence Then, the type of an object can't change, afaik
Then, casting has no sense in python That's my believing and opinion Correct me if i am wrong, please Regarding use for casting, you still see the need for it in some libraries 'casting' with reflection asked 16 years, 1 month ago modified 4 years, 6 months ago viewed 65k times The real question is what you want to do when/if the value in the unsigned int it out of the range that can be represented by a signed int
If it's out of range, that'll give an unspecified result so you'll probably want to reduce it the right range first, or assign it to a larger signed type.
WATCH