Python Forum
redefinition of a method in a class: pylint warning
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
redefinition of a method in a class: pylint warning
#1
Hello,
I try to redefine a method class (get_voiture_info) but pytlint (1.8) doesn't like what I wrote, and I don't anderstand why, what should I do to correct it? thank you
pylint.exe test.py
No config file found, using default configuration
************* Module test
W: 36, 4: Parameters differ from overridden 'get_voiture_info' method (arguments-differ)

------------------------------------------------------------------
Your code has been rated at 9.63/10 (previous run: 9.63/10, +0.00)
Here is the source code:
# -*- coding: utf-8 -*-
"""
blabal
"""


class Voiture:
    """
    blabla
    """

    name = ""

    def __init__(self):
        """bl"""
        print("je suis une voiture, je viens d'ête cree")

    def get_voiture_info(self):
        """bl"""
        print("J'ai quatres roues et un moteur{}".format(self.name))

    def test(self):
        """lkj"""
        pass


class PSA(Voiture):
    """
    blblbl
    """
    def __init__(self):
        """bl"""
        print("ici c'est PSA")
        super().__init__()

    def get_voiture_info(self, le_type):
        """bl"""
        print("cette tuture est une de PSA de type {}".format(le_type))

    def test(self):
        """h"""
        pass


class Truc():
    """
    blllll
    """
    yop = ""

    def __init__(self):
        """bl"""
        pass

    def machin(self):
        """bl"""
        print("le bidule{}".format(self.yop))

    def test(self):
        """r"""
        pass


VOITURE = Voiture()
PSA = PSA()

PSA.get_voiture_info("C4")

# citroen = Citroen()
# citroen.machin()
Reply
#2
Quote:A man is smoking a cigarette and blowing smoke rings into the air. His girlfriend becomes irritated with the smoke and says, “Can’t you see the warning on the cigarette pack? Smoking is hazardous to your health!”

To which the man replies, “I am a programmer. We don’t worry about warnings; we only worry about errors.”

on a more serious tone
https://stackoverflow.com/a/2295784/4046632
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  class definition and problem with a method HerrAyas 2 257 Apr-01-2024, 03:34 PM
Last Post: HerrAyas
  super() and order of running method in class inheritance akbarza 7 737 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  Using one child class method in another child class garynewport 5 1,594 Jan-11-2023, 06:07 PM
Last Post: garynewport
  [Solved] Novice question to OOP: can a method of class A access attributes of class B BigMan 1 1,318 Mar-14-2022, 11:21 PM
Last Post: deanhystad
  class, attribute and method Frankduc 9 2,471 Feb-27-2022, 09:07 PM
Last Post: deanhystad
  Subclass initialized property used in parent class method. Is it bad coding practice? saavedra29 5 1,796 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,712 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  anonymous method in a class Skaperen 8 3,604 May-23-2021, 11:17 PM
Last Post: Skaperen
  How to apply a class method to an entire dataframe column tirtha9 1 5,138 Jan-03-2021, 04:44 AM
Last Post: klllmmm
  Pylint more Fast leandrogmuller 2 2,198 Oct-20-2020, 05:21 PM
Last Post: leandrogmuller

Forum Jump:

User Panel Messages

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