apollo icon indicating copy to clipboard operation
apollo copied to clipboard

verify_client.py: don't determine the result via equal symbol

Open freeHackOfJeff opened this issue 8 years ago • 3 comments

That is wrong if using "==" to check up True of False in terms of Python semantics.

freeHackOfJeff avatar Jun 13 '18 07:06 freeHackOfJeff

You want to use "is" to check True or False? "is" indeed would be better in this case, but I tried in both python 2.7 and python 3.6, "is" and "==" both work.

Grayhu07 avatar Jun 14 '18 02:06 Grayhu07

Thank you for your comments.

However, works not means using correct and will not cause collision in other conditations in this way, etc... Actually, binary operater against True or False is totally wrong since ‘is’ and ‘==‘ is completely different considering check for equality or equivalent object. I’d recommend you to read Pep8 as a start to learn how to write code in Pythonic way.

在 2018年6月14日,10:40,Kechen Hu <[email protected]mailto:[email protected]> 写道:

You want to use "is" to check True or False? "is" indeed would be better in this case, but I tried in both python 2.7 and python 3.6, "is" and "==" both work.

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ApolloAuto/apollo/issues/4506#issuecomment-397150610, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AjCFy8CIV2L12SXJFhDssZBlRPWBO41-ks5t8cz_gaJpZM4Ulo_b.

freeHackOfJeff avatar Jun 14 '18 03:06 freeHackOfJeff

Currently closing this issue as it appears to be resolved.

natashadsouza avatar Aug 31 '18 20:08 natashadsouza