0

Is an int in Python 4 bytes? Is there a possibility to have a 64-byte 'long long' like in C++?

Trying to assign a variable:

a = 1234567891011121314

Gives this error:

error: can't allocate region

Barmar
  • 741,623
  • 53
  • 500
  • 612
user2874945
  • 308
  • 7
  • 16
  • Works for me in both python 2.7 as well as Python 3.x , Can you please post the exact error you are getting? – Anand S Kumar Oct 14 '15 at 18:22
  • Which version of Python? On what platform? Python has arbitrarily large `int`egers (`long` in 2.x), and that assignment works fine for me. Please provide a [mcve]. – jonrsharpe Oct 14 '15 at 18:23
  • 1
    Possible duplicate of [How does Python manage int and long?](http://stackoverflow.com/questions/2104884/how-does-python-manage-int-and-long) – QuestionC Oct 14 '15 at 18:23
  • Python can handle much much larger integers than C or C++ out of the box. Please post version and let us know if you're in a larger chunk of code or working in the interpreter. – BlivetWidget Oct 14 '15 at 18:25

1 Answers1

2

Python can handle arbitrary int sizes. The error you have indicates that python is trying to malloc more memory, but failed. You probably have a memory leak somewhere.

jh314
  • 27,144
  • 16
  • 62
  • 82