http://dustangroups.googlepages.com/privateattributesinpython

This is something that I just threw together this morning, after a
eureka moment. It's a way of creating private class attributes and
static function variables (I'm not 100% sure if that's the correct
terminology, but you get what I mean). I haven't tried to create
private instance attributes, mainly because it would just be too
difficult, and it would be awful syntax. I'm not considering actually
using this, but I do have a couple questions about it.

1. Has anyone else ever come up with something like this? I can't
imagine I'm the only person who's ever thought of this.
2. Is it possible to hack into something like this? ie, would it be
possible to see and change these variables from client code (assuming
the data manager has been properly removed from sight, as shown on the
last line of class block TestPrivateClassAttributes)?

To avoid utter confusion, you may want to look at
TestPrivateClassAttributes before looking at the actual implementation
of PrivateDataEngine. If you're still confused, feel free to ask
what's going on here (and I'm open to suggestions on how to make it
clearer).

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to