Request for feedback on my first Python program
Gerhard Haering
gh at ghaering.de
Sat May 31 22:11:06 EDT 2003
* Sean Legassick <sean at datamage.net> [2003-06-01 02:52 +0200]:
> In message <slrnbdeevn.694.andrew-usenet at athena.jcn.srcf.net>, Andrew
> Walkingshaw <andrew-usenet at lexical.org.uk> writes
> >def isMeaningful(line):
> > if line != "" and line[0] != "#":
> > return True
> > else:
> > return False
>
> Yuck!
>
> def isMeaningful(line):
> return line != "" and line[0] != "#";
>
> No offence intended, but I've seen this too often in real code not to
> point out its redundancy here.
No offence intended, but your code is redundant as well ;-)
def isMeaningful(line):
return not line.startswith("#")
And omit the trailing semicolon, you filthy C/C++/Java programmer :-P
Gerhard
--
http://ghaering.de/
More information about the Python-list
mailing list