Private data

Dustan DustanGroups at gmail.com
Mon Mar 19 06:06:21 EDT 2007


On Mar 19, 4:09 am, Bruno Desthuilliers <bruno.
42.desthuilli... at wtf.websiteburo.oops.com> wrote:
> Dustan a écrit :
>
> >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
>
> What for ? We already have one: prefix 'private' names with a single
> underscore.
>
> > and
> > static function variables (I'm not 100% sure if that's the correct
> > terminology, but you get what I mean).
>
> def somefunc(param, _statics={}):
>    # code here
>
> > I haven't tried to create
> > private instance attributes, mainly because it would just be too
> > difficult,
>
> Same recipe as above : single leading underscore.
>
> > 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.
>
> With something like trying to forcefit access restriction in Python ?
> Nope, you're not the first one here. I've not seen anyone using such a
> thing in any of the projects I've worked on/with yet.

You ignored certain parts of my post, like "I'm not considering
actually using this, but I do have a couple questions about it"; I
assume that means you're not even going to begin to attempt to answer
my queries. Likewise, you ignored a similar message on the page I
linked to. I already knew about everything you told me.

With all this active ignoring, I get the feeling you're not even
trying to respond to my questions. So why respond in the first place?
Were you trying to be hostile? Because I can't see any other intent
for your post.




More information about the Python-list mailing list