From: William Djaja Tjokroaminata Date: 2002-09-05T23:07:47+09:00 Subject: Re: Ruby aesthetics If I am not mistaken, the discussion was that it is equivalent (only a syntactic sugar) to write in Ruby def func (arg1, arg2, ...) @data1 = arg1 # direct data access .... with Python's def func (self, arg1, arg2, ...) self.data1 = arg1 # direct data access .... Of course, because Ruby follows Eiffel's function call model (indistinguishable data access and function call, at least from user's perspective, by making the parentheses optional), in Ruby @data1 and self.data1 are different. Now I don't remember if Python can do the "func=" form. In other words, if in Ruby we write def func (arg1, arg2, ...) self.data1 = arg1 # access through accessor function .... can we do this in Python? def func (self, arg1, arg2, ...) self.data1 () = arg1 # ???? syntax error ???? # probably should be the classic way: self.data1 (arg1) # access through accessor function But again, I don't think Python people (and probably even us) will consider this as a big deal. Regards, Bill =========================================================================== dblack@candle.superlink.net wrote: > I may be misunderstanding this discussion (I don't know Python), but > I'm not sure in what sense @ and self. are interchangeable in Ruby. > Or, I should say, I'm aware that there's a very limited sense in which > they sometimes are in effect interchangeable (simple accessor methods > vs. assignment to instance variables), but I don't think that extends > to the general case. > David > -- > David Alan Black | Register for RubyConf 2002! > home: dblack@candle.superlink.net | November 1-3 > work: blackdav@shu.edu | Seattle, WA, USA > Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com