I have a question about something in Python I can not explain:
in every programming language I know (e.g. C#) if you exceed the max-value of a certain type (e.g. a long-integer) you get an overflow. Here is a simple example in C#:
Code: Alles auswählen
static void Main(string[] args)
{
Int64 x = Int64.MaxValue;
Console.WriteLine(x); // output: 9223372036854775807
x = x * 2;
Console.WriteLine(x); // output: -2 (overflow)
Console.ReadKey();
}
Code: Alles auswählen
x = 9223372036854775807
print(type(x)) # <class 'int'>
x = x * 2
print(x) # 18446744073709551614
print(type(x)) # <class 'int'>
How does Python manages internally the types and their values? Where are they stored?
Thank you for your help