Python style guidelines
Heather Coppersmith
me at privacy.net
Thu Mar 11 06:34:43 EST 2004
On Thu, 11 Mar 2004 10:48:35 +0100,
Josef Meile <jmeile at hotmail.com> wrote:
>> Is there something missing you think should be there? There's no particular
>> reason a PEP needs to be continually updated. In particular, notions of
>> good Python style haven't changed a lot over the past ten years.
>> Skip
> I agree, those are good guidelines, but I don't agree with:
> - Don't compare boolean values to True or False using == (bool
> types are new in Python 2.3):
> No: if greeting == True:
> Yes: if greeting:
> What would happened if you do:
>>>> a='test'
>>>> if a.find('foo'):
> ... print "foo was found"
> ...
> foo was found
a.find does not return a boolean, so that particular style guideline
does not apply.
>>> if a.find( 'foo' ) == True:
... print 'foo was found'
probably isn't what you want either. ;-)
Regards,
Heather
--
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli
More information about the Python-list
mailing list