variable access question

Neil Schemenauer nascheme at enme.ucalgary.ca
Wed May 10 04:29:08 EDT 2000


oliver <fwang2 at yahoo.com> wrote:
>A beginner question: say I have the following classes A and B defined. 
>And B wants to access the variable "queue" inside A. How do i do that? or
>what is the most conventional way of doing it?

This is the answer to your question:

    class A:
        queue = Queue(10)

    class B:
        queue = A.queue

Are you sure you don't want to use instances and not classes?
You code seems to suggest you are confused. :)

    Neil



More information about the Python-list mailing list