A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/307615.html below:

Need to pass Object by value into a list

Need to pass Object by value into a list Need to pass Object by value into a listAaron aaronsuperguy at yahoo.com
Mon Sep 26 13:17:44 EDT 2005
I have a data sructure setup and I populate it in a loop like so:

y=0
while X:
   DS.name = "ASDF"
   DS.ID = 1234

   list[y] = DS;
   y = y + 1

print list

This does not work because DS is passed in by reference causing all
entries into the list to change to the most current value.  I cannot
find a "new" function in Python like there is in C++.  How do you do
this in Python?


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4