Explicit Frustration of the Self

Bengt Richter bokr at oz.net
Tue Dec 31 15:47:25 EST 2002


On Tue, 31 Dec 2002 16:19:32 GMT, Andrew Koenig <ark at research.att.com> wrote:

>> What of elegance?
>
>> class Life:
>> 	property = "value"
>> def Meaning(self, argument):
>> 		return self.property
>
>> This whole business with the self; it is not elegant.  And, it is of
>> my opinion that it is, therefore, not good programming.  So I'm
>> angry, because most of Python is so easy, so elegant, and this
>> ain't.
>
>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.

Regards,
Bengt Richter



More information about the Python-list mailing list