Do pythons like sugar?

Cliff Wells LogiplexSoftware at earthlink.net
Thu Jan 9 10:44:52 EST 2003


On Thu, 2003-01-09 at 02:47, 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.

"My design is perfect?".  I'll just let that speak for itself.

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

No, it's a fair assumption.  A *silly* assumption would be to assume
that someone who clearly isn't that familiar with Python would have a
*correct* implementation.

> >> Is there any tricky one-liner that brings object members in scope?
> >
> >Yes but I won't tell.  You shouldn't use it.
> 
> Excellent, thanks.

Although I too am a bit curious what Andrew's trick is, I'm guessing it
involves manipulating namespaces in an "interesting" way.  Not the sort
of thing to be encouraged.  He knows that if he told you, you'd probably
use it and then regret it later on when you realized its implications,
or that using it would prevent you seeing a better solution.

I can understand that you are perhaps irritated that you didn't get the
answer you were looking for.  If you had gotten a single reply that
simply read "No" would that have really made you happier?  You asked a
question to which that was a valid reply, but you also implicitly
presented a problem that you thought "with self do:" was an answer for. 
Rather than simply telling you "No" and letting you wonder, people were
trying to provide you with *alternative* methods that perhaps you would
find more palatable.  It seems that with your "perfect" design
(something I personally haven't seen in almost 20 years of programming
and that, of course, you won't reveal) that you are above criticism or
even suggestions.  If you dump a piece of code on a public forum, you
can expect it to be criticised.  That's *why* you put it there.


Regards,

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308






More information about the Python-list mailing list