Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
oliveoil
Apr 22, 2016
Is there anything like the JVM spec but for Python?

I want to know what I can assume about the way Python works. I want to know what's the memory overhead for creating an object, for example. How many bits are in an integer? And so on. I don't want to cobble together answers from StackOverflow that maybe describe the behavior of a specific Python implementation that isn't necessarily fixed, for example.

Also, I'd like to separately (so that I know what is prescribed for all Python implementations, and what is specific to or just an implementation detail of the most popular implementation) about the internals of the most popular Python implementation. I'm guessing that's CPython, but I imagine 2.7 and 3.blah are pretty different. In general, though, I want to know stuff like how does garbage collection work in CPython? What happens when I create a thread? How do locks work? Java has a bunch of explanation about "happens-before" relationships when writing multi-threaded programs - what's the Python equivalent?

Adbot
ADBOT LOVES YOU

oliveoil
Apr 22, 2016
Ugh. From the Python documentation, "Floating point numbers are usually implemented using double in C;": https://docs.python.org/2/library/stdtypes.html#numeric-types-int-float-long-complex

"Usually". So what's the behavior I can assume I always have? :(

oliveoil
Apr 22, 2016
The Python documentation says "Long integers are now stored internally either in base 2**15 or in base 2**30": https://docs.python.org/2.7/whatsnew/2.7.html#optimizations

What does that mean? I have never seen "base 2 to some power" used before. 2**15 = 32,768 and I really doubt this means that Python uses a base-32,768 number representation.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply