Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3807638
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:01:24+00:00 2026-05-19T15:01:24+00:00

The docs only say that Python interpreter performs basic optimizations, without going into any

  • 0

The docs only say that Python interpreter performs “basic optimizations”, without going into any detail. Obviously, it’s implementation dependent, but is there any way to get a feel for what type of things could be optimized, and how much run-time savings it could generate?

Is there any downside to using -O?

The only thing I know is that -O disables assert, but presumably one shouldn’t use assert for things that could still go wrong in production.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:01:25+00:00Added an answer on May 19, 2026 at 3:01 pm

    In Python 2.7, -O has the following effect:

    • the byte code extension changes to .pyo
    • sys.flags.optimize gets set to 1
    • __debug__ is False
    • asserts don’t get executed

    In addition -OO has the following effect:

    • sys.flags.optimize gets set to 2
    • doc strings are not available

    To verify the effect for a different release of CPython, grep the source code for Py_OptimizeFlag.

    Link to official documentation: https://docs.python.org/2.7/tutorial/modules.html#compiled-python-files

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Frequently, I've dug into apropos and docs looking for something like the following only
The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the
The docs for Dictionary.TryGetValue say: When this method returns, [the value argument] contains the
The Flex 3 docs are fairly basic. Can someone post a more complete example
I am aware that a CALayer's shadowPath is only animatable using explicit animations, however
jQuery.unique lets you get unique elements of an array, but the docs say the
The docs at www.fastcgi.com aren't clear on this (to me), so I hope someone
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#regroup I can think of a few ways of doing it with loops but
As per the Emacs docs , every time you open a file, Emacs changes
The iPhone SDK docs claim fopen() is a supported method of file access but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.