Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pylint question
#1
Hi, everyone. Here's my short snippet of code:

""" Module docstring goes here """

class Robot():
    """ Class docstring goes here """

    def __init__(self, x_axis=0, y_axis=0):
        """ Function/method docstring goes here """
        self.x_axis = x_axis
        self.y_axis = y_axis

    def move_robot(self, x_increment=1, y_increment=1):
        """ Function/method docstring goes here """
        self.x_axis += x_increment
        self.y_axis += y_increment

robot01 = Robot(4, 7)
print('\nrobot01 x,y =', robot01.x_axis, robot01.y_axis)
It runs fine. However, when I run it through pylint, it gives it a score of 7.78/10 for two reasons I don't understand:

Quote:pylint testrobot.py
************* Module testrobot
testrobot.py:3:0: R0903: Too few public methods (1/2) (too-few-public-methods)
testrobot.py:16:0: C0103: Constant name "robot01" doesn't conform to UPPER_CASE naming style (invalid-name)

1. What does it mean "too few public methods"?

2. Why should robot01 be in UPPER_CASE naming style?

Thanks for your help!
David
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pylint more Fast leandrogmuller 2 2,160 Oct-20-2020, 05:21 PM
Last Post: leandrogmuller
  pylint not recognizing some objects in VS Code marceloreborn 1 1,765 Jul-31-2020, 01:36 AM
Last Post: Larz60+
  Pylint/pyflakes/flake8 missed AttributeError elyoni 2 1,816 Feb-19-2020, 07:36 AM
Last Post: elyoni
  Pylint Statment Count Shangeetha 1 2,008 Dec-22-2019, 04:58 PM
Last Post: Larz60+
  pylint & #! pileofrogs 1 2,104 May-23-2019, 01:58 PM
Last Post: heiner55
  redefinition of a method in a class: pylint warning kboo 1 4,210 Feb-13-2018, 11:21 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020