From: Dan Doel Date: 2004-01-31T07:59:42+09:00 Subject: Re: Accesing to private attributes You can do it. [dolio 05:55:13 ~]$ cat prac.rb #!/usr/bin/ruby class Foo attr_reader :bar end obj = Foo.new obj.instance_eval { @bar = 3 } p obj.bar [dolio 05:55:17 ~]$ ./prac.rb 3 [dolio 05:55:23 ~]$ However, I think that, generally, this isn't a bad thing. In both Ruby and Python, it's obvious what you're doing. You're not likely to type that in by accident. Hiding instance variables may be good programming practice, but that doesn't mean you shouldn't be able to get at them if it's absolutely necessary. You shouldn't use that kind of thing a lot, but you have to trust people not to be stupid. - Dan