Do pythons like sugar?

holger krekel pyth at devel.trillke.net
Thu Jan 9 08:16:04 EST 2003


Afanasiy wrote:
> On Thu, 9 Jan 2003 22:29:33 +1100, Andrew Bennetts
> <andrew-pythonlist at puzzling.org> wrote:
> 
> >On Thu, Jan 09, 2003 at 10:47:13AM +0000, Afanasiy wrote:
> >> On Thu, 09 Jan 2003 03:25:41 -0700, some Dalke wrote:
> >> 
> >> >Afanasiy wrote:
> >> >>>A few languages provide syntax sugar for dealing with
> >> >>>this by allowing you to localize the class scope.
> >> >>>
> >> >>>Does Python? eg. `with self do:`
> >> >
> >> >> So the answer is a definitive no? I want to do things as I have them,
> >> >> I don't want to change my design just to be able to type 'self' less.
> >> >
> >> >It's a definite no.  From previous accounts, said sugar is hiding
> >> >rat poison.  It's advantages are slight to its disadvantages.  Eg,
> >> >for your case it would have hid a poor implementation rather than
> >> >yield a better one.
> >> 
> >> You don't know what I am doing. My design is perfect.
> >
> >What is good design for one language isn't necessarily good design for
> >another.  Python offers different features to, say, C++, and is best used in
> >different ways.  I would recommend that you try to understand the pythonic
> >world-view better, rather than insisting on imposing your preconceptions on
> >us... my experience agrees with Andrew Dalke's; explicit self is much better
> >than the alternatives.
> 
> If the "pythonic world-view" is that code which would look better with
> implicit self is "poor implementation", then no, I do not agree with it.
> 
> Please note I am not complaining out about the lack of this possibility.
> I only have a problem with the condescending tones. I guess it's normal.

They probably stem from strong oppinions about the "virtues" of implicit
instance references.  I guess i can understand the intentions of 
both sides.  

Sometimes you are doing lots of accesses to instance attributes 
in a specific (e.g. algorithmic) part of a method.  It makes sense 
to have a mechanism which lets you specify that certain
(otherwise local) names refer in fact to instance attributes. 

Good news is that i am currently implementing something
along these lines which allows to 'connect' local names with
instance attributes.  You have to explicitely specify these
names, though.  hopefully this will appeal to both sides.

cheers,

    holger





More information about the Python-list mailing list