> I have trouble understanding something in this code snippet: > > class TextReader: > """Print and number lines in a text file.""" > def __init__(self, file): > self.file = file > . > . > . > > > When would you do a thing like self.file = file ? I really don't > find an answer on this. Please help me understand this.
This is a standard object oriented programming idiom. You might find it useful to ask around on the 'tutor' mailing list of python -- http://mail.python.org/mailman/listinfo/tutor -- where you'll get detailed explanations on basic OOP and python topics. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list