What is self.file = file for?

wxPythoner at gmail.com wxPythoner at gmail.com
Tue May 13 18:08:26 EDT 2008


Hello!

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.



More information about the Python-list mailing list