Explicit Frustration of the Self

Bengt Richter bokr at oz.net
Wed Jan 1 00:56:16 CET 2003


On Tue, 31 Dec 2002 14:21:02 -0700, "Bjorn Pettersen" <BPettersen at NAREX.com> wrote:

>> From: Bengt Richter [mailto:bokr at oz.net]=20
>>=20
>> On Tue, 31 Dec 2002 16:19:32 GMT, Andrew Koenig=20
>> <ark at research.att.com> wrote:
>>=20
>[...]
>> >How would you like to be able to write it instead?  Show us some=20
>> >examples.  Whatever you come up with, I'll bet it will be possible to
>
>> >find even greater problems.
>> >
>> Someone proposed just a bare leading dot or invisible self name.
>>=20
>>   class Foo:
>>       bar =3D 123=20
>>       def baz(,arg):
>>           .arg =3D arg
>>           return .bar+arg
>>=20
>> It's less typing anyway. That's a plus for me.
>
>class Foo:
>    bar =3D 123
>    def baz(,arg):
>        class inner:
>            def baz(,arg):
>                .arg =3D arg   # <- Foo's arg or inner's arg?
>        return inner()
>
You have a point. I've even posted something using different
"self" names to make that distinction. But maybe names could
be optional and the default take care of 99% of usage.

Regards,
Bengt Richter




More information about the Python-list mailing list