Do pythons like sugar?
Laura Creighton
lac at strakt.com
Thu Jan 9 10:01:39 EST 2003
Ben Leslie wanted to know the difference between 'clever' and 'wise'.
Andrew 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.
>
> When I do a lot of "self." references it's mostly with a set of
> initializations. In that case I just leave "self." in my paste
> buffer.
>
> > Is there any tricky one-liner that brings object members in scope?
>
> Yes but I won't tell. You shouldn't use it.
Afanasiy is looking to be clever here. Andrew Dalke doesn't think that
it is wise.
<snip>
Laura Creighton
More information about the Python-list
mailing list