Python can be icky

Jul 02, 2008 12:52

It's generally know that you can do this in python:
a = (1,2)
b, c = a
print 'b: ', b
print 'c: ', c
b: 1
c: 2

But I find this icky for some reason:
a = ((1,2), 3)
(b, c), d = a
print 'b: ', b
print 'c: ', c
print 'd: ', d
b: 1
c: 2
d: 3

I know it isn't really that funky, but I just have higher expectations when it comes to Python syntax.

Leave a comment

Comments 1

chamewco July 2 2008, 23:27:24 UTC
Why is that? You're writing the same format of data to each of them. Makes sense to me why you would do that.

Reply


Leave a comment

Up