> >>> class Vector(tuple): > ... x = property(lambda self: self[0]) > ... y = property(lambda self: self[1]) > ... z = property(lambda self: self[2]) > ... > >>> Vector("abc") > ('a', 'b', 'c') > >>> Vector("abc").z > 'c' > >>> Vector("abc")[2] > 'c' >
Aha! You have simultaneously proposed a neat solution, and shown me a bug in my class! (It shouldn't accept strings) Thanks. Sw. -- http://mail.python.org/mailman/listinfo/python-list