Too Self Centered

Andres Rosado arosado at softhome.net
Fri Jan 10 20:09:02 EST 2003


On 09:21 PM 1/7/2003 -0500, the keyboard of python-list-request at python.org 
emitted:
>     def __init__(self):
>           f = open('test1','r')
>           while f.readline()!=''
>                 i += 1
>           self.total = i
>           f.close()

Or
self.total = len[x for x in f.readlines() if x != '']

If you use list compression.


--
Andres Rosado
Email: andresr at despammed.com
ICQ: 66750646
Homepage: http://andres980.tripod.com/

Pedaeration, n.:
     The perfect body heat achieved by having one leg under the
sheet and one hanging off the edge of the bed.
         -- Rich Hall, "Sniglets"  






More information about the Python-list mailing list