Explicit Frustration of the Self

Bjorn Pettersen BPettersen at NAREX.com
Tue Dec 31 16:21:02 EST 2002


> From: Bengt Richter [mailto:bokr at oz.net] 
> 
> On Tue, 31 Dec 2002 16:19:32 GMT, Andrew Koenig 
> <ark at research.att.com> wrote:
> 
[...]
> >How would you like to be able to write it instead?  Show us some 
> >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.
> 
>   class Foo:
>       bar = 123 
>       def baz(,arg):
>           .arg = arg
>           return .bar+arg
> 
> It's less typing anyway. That's a plus for me.

class Foo:
    bar = 123
    def baz(,arg):
        class inner:
            def baz(,arg):
                .arg = arg   # <- Foo's arg or inner's arg?
        return inner()

-- bjorn





More information about the Python-list mailing list