Access an object to which being bound

Abdur-Rahmaan Janhangeer arj.python at gmail.com
Wed May 27 16:33:55 EDT 2020


i have this:
https://github.com/Abdur-rahmaanJ/hooman/blob/master/hooman/hooman.py

someone PRed a Button class

i want the class button to be available to the class Hooman via
Human.button

self.button = Button

but button has update() which must be called individually

one way to update all buttons is to keep track of buttons instantiated
and calling update on each one. Wrap in a update_all () method

And please close your eyes to the wonderful mess

Kind Regards,

Abdur-Rahmaan Janhangeer
compileralchemy <https://compileralchemy.github.io/> | blog
<https://abdur-rahmaanj.github.io/>
github <https://github.com/Abdur-RahmaanJ>
Mauritius


On Thu, May 28, 2020 at 12:15 AM Chris Angelico <rosuav at gmail.com> wrote:

> On Thu, May 28, 2020 at 5:48 AM Abdur-Rahmaan Janhangeer
> <arj.python at gmail.com> wrote:
> >
> > Greetings,
> >
> > Lets say i have
> >
> > class A:
> >   ...
> >
> > class B:
> >    self.x = A
> >
> > then used
> >
> > b = B()
> > z = b.x()
> >
> > now how in A i get a reference to B when z is assigned to b.x?
> >
>
> Things are very tangled here. What exactly are you doing? Your code is
> incomplete at the moment, and I'm not sure what you're trying to
> achieve. As it currently stands, class A is completely stand-alone and
> will not have any way of knowing about B.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list