Access an object to which being bound

Chris Angelico rosuav at gmail.com
Wed May 27 16:15:37 EDT 2020


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


More information about the Python-list mailing list