the annoying, verbose self

Ton van Vliet sheep.in.herd at green.meadow
Sat Nov 24 13:05:04 EST 2007


On 24 Nov 2007 16:07:18 GMT, Duncan Booth
<duncan.booth at invalid.invalid> wrote:

>Ton van Vliet <sheep.in.herd at green.meadow> wrote:
>
>> It would boil down to choice: explicit/speed vs implicit/readability
>
>No, it would boil down to explicit+speed+readability+maintainability vs 
>implicit+error prone.

It would not be a full fledged *implicit*, but only used in small
areas where many self's are coming together, and possibly clutter
readability (a subjective classification anyhow) and even could
degrade (code) maintainability.

>It would mean that as well as the interpreter having to search the 
>instance to work out whether each name referenced an attribute or a global 
>the reader would also have to perform the same search.

IMHO if it is limited to small overviewable sections I think it could
make life of the reader/coder/maintainer even easier and less error
prone.

I cannot judge for the interpreter part (*if* at all doable, it would
probably be the coder's choice between speed and readability)

>It would mean that adding a new attribute to an instance would change 
>the meaning of the methods which is a recipe for disaster.

I don't see what you have in mind here?

As stated some message levels back: 'bear with me', I'm not an expert,
just a beginning user ;-)

I have no problems with the explicit self at all, but just brought up
Pascal's 'with' statement, invented to improve readability only (and
saving some typing as well) and 'transposed' it to python, just as my
2 cents.

I don't want to defend or formally propose an implementation, just
giving comments where *I* do not fully understand the counter
arguments.

So let's not 'beat it to death', ok ;-)

-- 
Ton



More information about the Python-list mailing list