
On 11 February 2010 14:51, Gerald Britton <gerald.britton@gmail.com> wrote:
Say you had a problem where you started with a basic tuple, then needed to add items to it to produce some result. Now suppose you want to do that repeatedly. You don't want to disturb the basic tuple, so you make a copy of it before extending it.
e.g.
country = ("US",) country_state = tuple(country)+("NY",) country_state_city = tuple(country_state) + ("NY",) country ('US',) country_state ('US', 'NY') country_state_city ('US', 'NY', 'NY')
if tuple() had a copy() method, I could write:
country_state = country.copy() + ("NY",)
etc.
You do know that tuples are immutable, don't you? Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
country = ("US",) country_state = country+("NY",) country_state_city = country_state + ("NY",) country ('US',) country_state ('US', 'NY') country_state_city ('US', 'NY', 'NY')
It sounds like you could do with reading the Python documentation a bit more closely before proposing changes... Paul