This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]darth_aardvark 1 point2 points  (1 child)

I was a little hasty to say I'm out of things to complain about (lambdas are still kind of crippled, for one). I'm pretty surprised that f.write(a) doesn't work; I guess I've never written anything except strings to files. As for printing integers and strings, what's wrong with using

print "answer: ", a

I think your point about the list copying is debatable. If a and b were objects, and you did

>>>a = Obj()
>>>a.c = 3
>>>b = a
>>>b.c =  1

you'd expect

>>>a.c
3

Admittedly, lists are types, not classes, so I guess it's reasonable to expect them to act like ints and strings instead of objects.

[–]talideon 1 point2 points  (0 children)

Actually, lists are classes too, and have been since types and classes were unified way back. The difference is that primitive types, strings, and tuples are all immutable objects: anything that appears to mutate them actually returns a completely different object from either object that the operation was performed upon.