# Question about Python Code Styles

**URL:** <https://discuss.tvm.apache.org/t/question-about-python-code-styles/10980>\
**Category:** Questions\
**Created:** [September 9, 2021, 11:08am UTC](https://discuss.tvm.apache.org/t/question-about-python-code-styles/10980 "2021-09-09T11:08:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshr-h](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/mshr-h/32/5128_2.png) [@mshr-h](https://discuss.tvm.apache.org/u/mshr-h)\
**Post date:** [September 9, 2021, 11:08am UTC](https://discuss.tvm.apache.org/t/question-about-python-code-styles/10980/1 "2021-09-09T11:08:21Z")

</div>

Hi there,

We’re implementing additional layer support on Caffe frontend into our internal codebase. And we’re also considering to contribute our code to upstream.

We’ve checked [contribution guide](https://tvm.apache.org/docs/contribute/index.html) and it mentions that it’s required (or better?) to check our code style using `make pylint`.([Code Guide and Tips — tvm 0.8.dev0 documentation](https://tvm.apache.org/docs/contribute/code_guide.html#python-code-styles))

However, it doesn’t specify which message types should be fixed and which one can be ignored.

Is there any specific rules for that?

For instance, we got the below pylint messages. Should we fix them?

```auto
caffe.py:610:4: R0914: Too many local variables (21/15) (too-many-locals)
caffe.py:627:17: R1735: Consider using {} instead of dict() (use-dict-literal)
caffe.py:673:15: C0121: Comparison 'some_value == True' should be 'some_value is True' if checking for the singleton value True, or 'some_value' if testing for truthiness (singleton-comparison)
caffe.py:676:22: R1735: Consider using {} instead of dict() (use-dict-literal)
caffe.py:681:21: R1735: Consider using {} instead of dict() (use-dict-literal)

```

---

<div class="post-metadata">

**Author:** ![comaniac](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/comaniac/32/899_2.png) [@comaniac](https://discuss.tvm.apache.org/u/comaniac)\
**Post date:** [September 9, 2021, 4:29pm UTC](https://discuss.tvm.apache.org/t/question-about-python-code-styles/10980/2 "2021-09-09T16:29:27Z")

</div>

For linting, you could follow the pylintrc under tests/lint/pylintrc.

For formatting, you just need to run `pip3 install black; black -l 100 yours.py`

---

<div class="post-metadata">

**Author:** ![mshr-h](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/mshr-h/32/5128_2.png) [@mshr-h](https://discuss.tvm.apache.org/u/mshr-h)\
**Post date:** [September 11, 2021, 6:42am UTC](https://discuss.tvm.apache.org/t/question-about-python-code-styles/10980/3 "2021-09-11T06:42:37Z")

</div>

Hi @comaniac,

Thanks for your answer!
