473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to force a list to be local?

In the following code, t1 does not modify b, while t2 seems to
modify b. What do I need to do in order to make b local in t2
so that b.remove() does not modify the passed in list?

def t1(a,b):
b = []

def t2(a,b):
b.remove(4)
a=[1,2,3]
b=[4,5]

t1(a,b)
print a,b

t2(a,b)
print a,b

results:
[1, 2, 3] [4, 5]
[1, 2, 3] [5]

Many TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
Jul 18 '05 #1
0 754

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marc | last post by:
Hi all, I have an application that uses a Pmw ComboBox to display a list that is dynamic. The user has the ability to add and delete items from the list at different points in the program. ...
0
by: Marc | last post by:
Hi all, Perplexed by this. I thought the sticky option was supposed to accomplish this task, but it doesn't seem to be working. Here is what I'm trying to accomplish. Window...
6
by: manatlan | last post by:
I've got a trouble, and i think that anybody there can help me I've got a python script which i distribute in somes packages for *nix. This script is full of python and need python 2.4 ! And i'd...
6
by: Ray | last post by:
DB2 V7.2 Is it possible to list applications connected to a node by Auth ID? Is it possible to force applications connected to a node by Auth ID or am I forced to use App. Handle? Thanks, Ray
2
by: Raquel | last post by:
FORCE APPLICATION command is valid only at the 'instance' level. Why is this so? An instance may contain many databases. So, what command do I give if I want to force applications from a particular...
3
by: Stuart Read | last post by:
Hi, - I'm running .NET framework 1.1 on win2k server I'm investigating error pages at the moment. I have found how to: a) display friendly or real .NET errors in the remote browser, by...
0
by: mel_apiso | last post by:
Hi, after uncatalog one database, and catalog again with other name, if I try to connect with this database, everything is ok, but list applications only show me the connection with the...
1
by: JP SIngh | last post by:
Hi All We have a page which we want to allow our users to download files. Can someone point to peice of code that we can use to force the download as opposed to opening the files in the...
3
by: e | last post by:
I have a form which includes a list box populated with items from a query. When a user double clicks on a row in the list box, each column item is put into a specific text box. The problem...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.