April 28th, 2005, 10:38 PM
Bastion Alternative in 2.3 and later
Bastion module which was used pre 2.2 for encapsulation, is there any alternative modules/technique in python that support such features similar to public/private in c++
April 29th, 2005, 02:36 PM
I have seen something like this done using function decorators however I can't find the page I saw it on, maybe someone else has seen it . Anyway so far as I can see you should use it with rexec, which is a really bad idea.
That said, if you really did want to lock down a class you could write a base class that protects it attributes unless say, a password was supplied. If you wanted to do this you would use the __setattr__ and __getattr__ methods, however I haven't played with these much.
Hope this helps,
April 29th, 2005, 10:25 PM
Thanks netytan, I'll do more research on the internet