#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    73
    Rep Power
    11

    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++
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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,

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    73
    Rep Power
    11
    Thanks netytan, I'll do more research on the internet

IMN logo majestic logo threadwatch logo seochat tools logo