invalid at invalid.invalid
Fri Oct 31 18:40:44 CET 2014
On 2014-10-31, Seymore4Head <Seymore4Head at Hotmail.invalid> wrote:
> On Fri, 31 Oct 2014 15:49:43 +0000 (UTC), Grant Edwards
><invalid at invalid.invalid> wrote:
>>On 2014-10-31, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>>> On Fri, Oct 31, 2014 at 8:05 AM, Seymore4Head
>>><Seymore4Head at hotmail.invalid> wrote:
>>>> Because the topic of that lesson was getter setter.
>>>> I can construct an __init___ but I was practicing get/set.
>>> Doesn't sound like a very good lesson to me.
>>It's not. It's teaching java or C++ or some other language while
>>using a Python compiler.
>>> Getters and setters are the Java way of doing things. The Pythonic
>>> way is to just use an attribute, and then replace it with a property
>>> in the unlikely event that getter/setter logic needs to be added.
> In this class, we will follow the practice of accessing the contents
> of objects using methods known as getters and setters.
"In this class, we're not going to learn Python. We're going to learn
Java. But actually _using_ Java is too much hassle, so we'll write
Java using Python instead."
> While not required by Python, this practice encourages the user of
> the class to manipulates class objects solely via class methods.
Which is a Java/C++ thing.
> The advantage of following this practice is that the implementer of
> the class definition (often someone other than the user of the class)
> may restructure the organization of the data fields associated with
> the object while avoiding the need to rewrite code that uses the
That's wrong. That statement about using getter/setter having that
advantage is false (if you're talking about Python). It may be true
in Java or C++ or whatever language the lesson's author is teaching,
but it's not true of Python.
Grant Edwards grant.b.edwards Yow! A shapely CATHOLIC
at SCHOOLGIRL is FIDGETING
gmail.com inside my costume..
More information about the Python-list