Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MIT course
#3
Quote:is strongly advice to always use getters and setters and not access data attribute directly.

I do use them when appropriate, but only then.

There have been several trends at MIT lately that have been unsettling.
I don't feel that this should become a rule, what would it serve.

I could jest (pun intended) as easily make a statement saying that you must use the subway everywhere you go.
That would certainly limit your range.

This sounds like a power thing to me, not a piratical one, probably by an ex Java programmer.

Bottom line. I don't hate them, but I don't see where they should be a rule either.

Snippsat, google this 'getters and setters in python'

You will not be happy, here's what comes up in the highlighted top box:


Quote:Getters and setters are used in many object oriented programming languages to ensure the principle of data encapsulation. They are known as mutator methods as well. ... Unfortunately, it is widespread belief that a proper Python class should encapsulate private attributes by using getters and setters.
It's actually against the use of them, but your eye doesn't immediately catch the 'Unfortunately' and it looks as though they are advertising their use.
Reply


Messages In This Thread
MIT course - by snippsat - Feb-16-2017, 10:06 PM
RE: MIT course - by ichabod801 - Feb-16-2017, 10:13 PM
RE: MIT course - by Larz60+ - Feb-16-2017, 10:54 PM
RE: MIT course - by Ofnuts - Feb-17-2017, 07:42 AM
RE: MIT course - by snippsat - Feb-16-2017, 11:37 PM
RE: MIT course - by micseydel - Feb-17-2017, 07:13 AM

Forum Jump:

User Panel Messages

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