[Tutor] instance variables and the instance dictionary
Bob Gailer
ramrom@earthling.net
Fri Jan 10 16:45:04 2003
--=======4F8368B7=======
Content-Type: text/plain; x-avg-checked=avg-ok-64186D05; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit
Another interestng anomaly is:
>>> class xx(list):
... def clear(self):
... self = []
...
>>> aa = xx([1,2,3])
>>> aa
[1, 2, 3]
>>> aa.clear()
>>> aa
[1, 2, 3]
Note that self = [] does nothing, and raises no exception!
BTW the proper way to do this is:
self[:] = []
Bob Gailer
mailto:ramrom@earthling.net
303 442 2625
--=======4F8368B7=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-64186D05
Content-Disposition: inline
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.438 / Virus Database: 246 - Release Date: 1/7/2003
--=======4F8368B7=======--