Sergey> posix.stat_result is CLASS, not regular tuple. >> I believe it morphed from being a tuple though. I wasn't suggesting >> that
Sergey> It it morphed, the tuple nature of it is just history now. No, it is still full of tuple-fu: >>> import os >>> s = os.stat("/etc/hosts") >>> s (33188, 92111L, 26738688L, 1, 0, 1, 355L, 1171570459, 1164401316, 1171087243) >>> type(s) <type 'posix.stat_result'> >>> s.st_mtime 1164401316 >>> s[0:3] (33188, 92111L, 26738688L) >>> s[4:] + s[0:3] (0, 1, 355L, 1171570459, 1164401316, 1171087243, 33188, 92111L, 26738688L) >>> type(s[4:] + s[0:3]) <type 'tuple'> >> The notion of tuples as records in Python is not new: >> http://mail.python.org/pipermail/python-list/1999-December/thread.html >> Search for "super tuples". Sergey> Did it go beyond just talking? Raymond Hettinger just proposed adding a pure Python implementation to Python 2.6. The version he's been using for about a year is here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/500261 Sergey> We can think about tuples anything, but are they something other Sergey> than freezed lists? We can index them, slice, iterate, Sergey> map/redice/filter, can cast (fuckin C!) to lists and back - Sergey> what the difference?? "Tuples is similar to records" - I think Sergey> this is just topological artefact, generated when python was Sergey> compared with some other languague :) The fact that tuples and lists share so many implementation details makes people think of tuples as immutable lists. That view has its uses (allowing you to pretend that you can use lists as dictionary keys or take advantage of the compile-time allocation of tuples of constants, for example), but I don't think that makes the view of tuples as records a "topological artifact". I'm not sure where you believe Python was compared to some other language. My original comment was that tuples could be thought of more like C structs or Pascal records. That was an analogy, not a language comparison. Sergey> classes have sintactically and functionally overcame Sergey> records/structs - why to drag to the same role tuples, that have Sergey> not initially any feature of record? They have a number of record-like features. They are relatively compact (unlike class instances), once instantiated they can't be extended (unlike lists or class instances in the common case). They just don't yet have named attributes. Skip -- http://mail.python.org/mailman/listinfo/python-list