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 8102627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:17:19+00:00 2026-06-05T23:17:19+00:00

The program I’m coding now makes a pretty huge list of data items. Now,

  • 0

The program I’m coding now makes a pretty huge list of data items.

Now, I can make this list to be global (make available for other functions in other modules) and can be used in all other modules. Or, I can also pass them as a function arguments for the functions in the modules.

Note that, this huge array I’m talking about is not going to get modified in the functions in other modules, they just read data and use it for calculations and data stats etc.

So, of the two methods which has least memory consumption?

If by passing into the functions, if the language makes a local duplicates of the huge list even if the functions doesn’t modify it .. that’ll be doubling of the memory consumption which is not good thing. If this happens, I can make it global and use it. I got this doubt on memory management of python because when I once wrote a toy language, I included this particular issue.. i.e the argument data gets duplicated only if its edited .. else, it’ll always be pointed to the original data.

  • 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-06-05T23:17:21+00:00Added an answer on June 5, 2026 at 11:17 pm

    Firstly, there’s no such thing as a ‘global’ variable in Python (in the sense that it’s automatically available to all modules).

    Secondly, Python doesn’t duplicate objects when passing to a function. Python variables are really just names that point to objects – when you pass a variable to a function, all that happens is that the function creates a new name that points to the original object. You can read or modify the contents of that object without any copies being made. (Note that if you rebind the name to a different object, the original reference is not changed.)

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

Sidebar

Related Questions

This program builds a dictionary out of a list based on what two index
Example program: list links This example program demonstrates how to fetch a page from
This program is supposed to create a button that the user can press to
Program that calculates and shows the value of (2 to the 10th power) This
Program runs once and it both throws data to the pipe and gets it
This program returns: package main import ( flag fmt ) func main() { num_agents
This program runs just fine, but for some reason when I ask for an
Program I'm making has a simple configuration file looking something like this. @overlays =
This program so far has one purpose, take in two integers(the size of the
Program : List all C files in the current folder using execlp() system call:

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.