On 2010-10-12, Chris Rebert <c...@rebertia.com> wrote: > 2. > self.f = file(path, 'r') > if not self.f: > return None > > The "if" here is pointless; I'm reasonably sure files are always > considered boolean true.
I actually seem to have done this wrong anyway -- I was thinking in terms of the C-like idiom of returning NULL when a constructor-like thing fails. This ought to have been a raise of some sort to prevent the caller from getting an object that didn't work out. > Python's grammar has "not in" as an "operator" for just such occasions ==> Ahh! -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nos...@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! I am not speaking for my employer, although they do rent some of my opinions. -- http://mail.python.org/mailman/listinfo/python-list