Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lint and private var names
#1
I've been using _ to start private variables but I've also just found tried out pylint and it complains that the private vars are not snake-case.

I don't really care if I use snake-case or _ style myself but I want to make the code readable for others (which is part of the reason for trying out pylint).

Is there a way to make pylint think leading _'s are OK or is snake-case fine for private variable names? If snake-case then what to use for public variables?

Inquiring ignoramuses want to know!

Thanks
Reply
#2
I use pylint and it doesn't complain. My guess is you are using the leading underscore incorrectly. You use a leading underscore to indicat that a CLASS ATTRIBUTE should be treated like it is private. Variables need no such convention because they really are private. You cannot access a variable from outside its scope.

Can you provide an example of code where pylint issues the warning?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to import Private Repo using setup.py Bob786 1 1,766 Sep-02-2021, 04:19 PM
Last Post: snippsat
  python 3 dns lookup private domain didact 1 2,578 Sep-19-2020, 06:01 PM
Last Post: bowlofred
  [split] Помощь по приватным ключам/Private key help sairam17519 0 1,612 Sep-07-2020, 12:55 PM
Last Post: sairam17519
  Download file from Private GitHub rep vinuvt 0 1,981 Jul-27-2020, 11:38 AM
Last Post: vinuvt
  Private package distribution abomination disadvantages research andreir 2 2,166 May-07-2020, 12:32 AM
Last Post: andreir
  Помощь по приватным ключам/Private key help vlrubl777 5 5,969 Mar-15-2019, 08:16 PM
Last Post: vlrubl777
  when to make attributes private? sneakyimp 10 5,894 Jan-21-2019, 02:54 PM
Last Post: sneakyimp
  Fetching private ip address from instances of an autoscaling group deepsonune 0 3,279 May-18-2018, 10:32 AM
Last Post: deepsonune
  Inheritance private attributes vaison 5 12,788 May-03-2018, 09:22 AM
Last Post: vaison
  Can access class private variable? Michael 2 7,197 Aug-11-2017, 01:59 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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