Do pythons like sugar?

Andrew Bennetts andrew-pythonlist at puzzling.org
Thu Jan 9 06:29:33 EST 2003


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.

Not to mention that the code you have shown us doesn't give me any confidence
that your code is what you claim it to be.

> In my situation, your way is wrong. I am not looking to
> hide a poor implementation. That's a rude assumption.

What is your situation?  You're refusing to say what it actually is, so it's
reasonable for people to refuse to try help you -- its hard to know what the
answer is if you won't tell us the question!

Show us your code, and let us help you.

-Andrew.






More information about the Python-list mailing list