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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:31:47+00:00 2026-05-24T16:31:47+00:00

Currently I am using the copy module to create a copy of some object

  • 0

Currently I am using the copy module to create a copy of some object that I have.

Under certain conditions (that occur frequently), I will need to create possibly several copies of the original object, and then modify each of them individually (hence why I am using copy).

The object has several instances of various datatypes (lists, ints, strings, other classes), and the copies need to have the same values, but I am not sure whether it would faster to call copy.deepcopy(), or do something like

def copy(self, other):
   other.prop1 = self.prop1
   other.prop2 = self.prop2
   other.prop3 = self.prop3

Has anyone run into this problem and then decided it was better to use the copy module because it would be faster than anything most people could come up with?

PS: the code above wouldn’t properly copy mutable objects and those “other classes” that I mentioned. Perhaps that suggests deepcopy is the safest (and fastest) route?

  • 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-24T16:31:50+00:00Added an answer on May 24, 2026 at 4:31 pm

    Not trying to be glib, but have you considered profiling your code? Documentation here. Compare copy.deepcopy with with your own custom copy method. That way you’ll have hard data on your particular situation and can make the best decision–and back it up if anyone asks why you did it that way!

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

Sidebar

Related Questions

Supposing I have a merge module that installs a file MyFile.txt to a certain
I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE
Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control. We have licenses for Telerik. I
I am currently using Windows Server 2008 Standard and have several Hyper V machines.
We are currently using a somewhat complicated deployment setup that involves a remote SVN
I currently have Zend setup to look for a layout script in each module's
I'm currently implementing a copy constructor for a Linked List class. When I create
I'm using the migrate module to copy data from several sources to a new
I'm currently using Extension:Push to copy articles from one MediaWiki (1.16) installation (which sits
I am currently using 100 megabytes per memory block to copy large files. Is

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.