[Tutor] Need to discuss about a class that can be used to print number of vowels, consonants, uppercase and lowercase letters and spaces in a string

Peter Otten __peter__ at web.de
Fri Aug 20 08:09:15 EDT 2021


On 19/08/2021 23:44, dn via Tutor wrote:

> language where it is a requirement) that all data-attributes should
> either be defined in the class or __init__()?
> 
> (I realise that in Python we (usually) initialise value, which
> (inherently) defines the attribute's type, rather than considering them
> two potentially-separate steps)
> 
> I remember being 'dinged' about this by some 'checker' facility. Regret
> unable to reference which one.

pylint, probably:

PS C:\Users\Peter> type demo.py
class Stuff:
     def __init__(self):
         self.x = 0
     def update(self):
         self.y = 0
PS C:\Users\Petery> pylint demo.py
************* Module demo
...
demo.py:5:8: W0201: Attribute 'y' defined outside __init__ 
(attribute-defined-outside-init)
...
------------------------------------
Your code has been rated at -4.00/10

But it's  hard to take a checker that awards minus four out of ten 
points seriously:)



More information about the Tutor mailing list