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

  • SEARCH
  • Home
  • 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 8814459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:07:41+00:00 2026-06-14T04:07:41+00:00

The Hitchhiker’s Guide to Python states that it’s good to reuse variable names. foo

  • 0

The Hitchhiker’s Guide to Python states that it’s good to reuse variable names.

foo = Spam()
bar = foo.eggs()

And I agree w/ it. It makes code readable.

What if the variable is 40 MB of data? Will it copy itself and have 80 MB at total?

foo = buffer  # 40 MB.
bar = foo.resize((50, 50))  # +40?

I know that memory will be released when function will be executed, but I still don’t think that it’s a good idea to have like two times higher memory usage at one state of app only because of readability. It’s like a special case, but on the other hand, special cases aren’t special enough, huh?

  • 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-14T04:07:44+00:00Added an answer on June 14, 2026 at 4:07 am

    Python assignment just copy the reference value to the target object. There is no data copying. Python variable is just the name in a Python system dictionary plus the value which is the reference value to the object.

    Actually, you should be careful with assignments. Any Python assignment means sharing the reference value. Python assignment never means copying the target object. When working with immutable objects like strings or numbers, no problem can appear. However, when you assign any mutable object (a list, a dictionary, a set, some user object), you should know that after that you are only giving the target object a different name (access via another copy of the reference value).

    The same holds for passing the object as a function/method argument.

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

Sidebar

Related Questions

The Hitchhiker's guide to Algorithms discusses the following pointers: 1.6 Counting or Optimizing Good
I have a Python module that I would like to upload to PyPI. So
I read this statement in Hitchhiker's guide to algorithms. But, I'm not able to
After going over the Hitchhiker Guide to Packaging and some other blog posts I
I'd like to parse the content of an .opf-file (that's a file that contains
I have to files that I need to combine together using Apache PIG. First
We all know that 42 is the answer to everything , but it's news
I have a game I am working on that has homing missiles in it.
assume that i have a BlogPost model with zero-to-many embedded Comment documents. can i
I'm looking for the correct way to prototype, initiate a Python project. PasteScript has

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.