[Tutor] Initializing Tupples
Jonathon
jblake@stamp-coin.com
Wed, 25 Aug 1999 03:10:57 +0000 (UTC)
I'm trying, unsuccessfully, to initialize a tupple.
The code is as follows:
blank_string = " "
blank_number = 0
new_tupple = ( blank_string, blank_string, blank_string, blank_number, blank_string, blank_number, blank_number )
# actually, it is 90 items long - the first 50 are blank_string, then the rest are a mix of strings and numbers
The error message I get is:
"TypeError: object does not support item assignment"
Thinking perhaps I needed braces, rather than parenthesis
I used them instead, with the same error message.
My specific aim is to initialize a tupple to a set of default values
then change the value of various items, according to needs.
I'm making perhaps three fatal assumptions:
#1: tupple is to python as record is to Pascal.
#2: strings and numbers in a tupple can be changed.
#3: the number of elements in a tupple can not change.
FWIW, I also tried curlyques, but that gave the standard SyntaxError
message. Which is what I expected, given that they are for
dictionaries, and I wasn't setting one up here.
Basically, I am using tupples exactly as if they were the same as
Pascal's Record type. Which means that i can change the data
in them, so long as the type of data is not changed.
xan
jonathon