Antoine De Groote:
> Allowing "$" as a substitute for "self" wouldn't require this new syntax.
> class C:
>     def method($, arg):
>         $.value = arg

I think this (that is just sugar) may be a little better:

class C:
    def method($, arg):
        $value = arg

Or even this, combined with the idea suggested in the post by Guido:

class C:
    def $method(arg):
        $value = arg

(Note there's no point after $, it's not currently possible).
Ruby uses @ and @@ for similar purposes.
I agree that the code looks worse, but also shorter to read and write,
so in lines of code that use many instance attributes, that short $
syntax helps keep the line shorter. So I may grow to accept this
sugar...

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to