Request for feedback on my first Python program

Bengt Richter bokr at oz.net
Sun Jun 1 00:20:05 EDT 2003


On Sun, 1 Jun 2003 05:30:39 +0200, Sean Legassick <sean at datamage.net> wrote:

>In message <20030601021106.GA7831 at mephisto.ghaering.de>, Gerhard Haering 
><gh at ghaering.de> writes
>>No offence intended, but your code is redundant as well ;-)
>>
>>def isMeaningful(line):
>>    return not line.startswith("#")
>
>Indeed, that is cleaner.
>
but at the expense of being wrong ;-)

    def isMeaningful(line):
        assert line==line.strip() # to document the assumption
        return bool(line) and not line.startswith("#")

Regards,
Bengt Richter




More information about the Python-list mailing list