diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc
index 724b69c703fb39b884b798da1ab5a4bda286faef..2982a89fad11b045717505b854f2e144d99b93b8 100644
--- a/src/compiler/python_generator.cc
+++ b/src/compiler/python_generator.cc
@@ -249,7 +249,7 @@ bool GetModuleAndMessagePath(const Descriptor* type,
   do {
     message_path.push_back(path_elem_type);
     path_elem_type = path_elem_type->containing_type();
-  } while (path_elem_type != nullptr);
+  } while (path_elem_type); // implicit nullptr comparison; don't be explicit
   grpc::string file_name = type->file()->name();
   static const int proto_suffix_length = strlen(".proto");
   if (!(file_name.size() > static_cast<size_t>(proto_suffix_length) &&