Re: dealing with objects of 2 classes
Bartosz SKOWRON <[email protected]> Mon, 15 Jun 2009 06:37:18 +0100
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jun 15, 2009 at 5:23 AM, Stefan Behnel<[email protected]> wrote: >> when i create new object of class b, `b(a())` =A0i get: >> AttributeError: 'a' object has no attribute 'foo' >> >> when i create new object of class c, `c(a())` =A0i get: >> AttributeError: 'c' object has no attribute '_foobar' > > You have to declare the variables that you assign the objects to, as in > > =A0 =A0 =A0 =A0cdef b some_b > =A0 =A0 =A0 =A0some_b =3D b(a()) > =A0 =A0 =A0 =A0print some_b.foo.some_struct_member but that b(a()) I would like to do from the Python interpreter, not in Pyre= x.