Or add a __setattr__ method, but the above is easier.
I'd sort of argue that adding a __setattr__ for that purpose is
un-Pythonic (as opposed to using __setattr__ for some functional purpose
and that restriction being a side-effect). Its possible to do it, sure;
but its also possible to use __slots__ to do so as well. But its bad
form in both cases.
But, that argument is largely Nit meeting Pick and having a fight about
which kettle is blacker.
--
Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog:
http://meh.ixokai.io/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
iQEcBAEBAgAGBQJMH7WUAAoJEKcbwptVWx/ldKoH/AsDuR7je1zUi7KCpQb/dWAW
sb8vHU6cqu95hVE848wGnl2ajzjEWyZPVu/J1bbur37Zrd/DHOYNAeFygf8oW6/4
RrFBBoQUYjaEneogwM7oUSdK8iNaWawtzsFxPEVNKbnG0qHHodykv8WvSIZLkrly
nIZZHCn0tIWe1drsuRfVdg+f6l66Ak57yuDpspJRiTkVVwFcphKzmsivo7rzkBn1
5W3y0O1S5zlJ9wk2p8fUhd5aMC03kAcWICLOpCHx0OOXt1APD48f3+98mLP9XYBD
QGOx0+T7ynz7EbiY1xirPgVKITRQBXVnpk9cxXdgDNlbmF6skUbmBP9+whVqAdI=
=+VzQ
-----END PGP SIGNATURE-----