|
Re: accessing the python type system: msg#00344python.c++
Stefan Seefeld <seefeld@xxxxxxxxxxxx> writes: > David Abrahams wrote: > >> I've been trying to say that I think the right answer is to provide a >> boost::python::object called 'type', something like: >> object const type = extract<object>(PyTypeObject*); >> so you could do: >> object y = type(x); > > oh, now I understand (at least partly). But this last line really > *creates* a type object given another object. So I don't understand > why 'type' has to be an object. Why not simply make it a function ? Because it's an object in Python. You should be able to say: if (x.attr("__class__") == type) { // whatever } for example. Or type.attr("__doc__") or... > Users' expectations would still be satisfied (the last line above > would still be valid), Not all of them. -- Dave Abrahams Boost Consulting www.boost-consulting.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: accessing the python type system: 00344, Stefan Seefeld |
|---|---|
| Next by Date: | Re: Support for Indexing and Iteration Safety: 00344, Mike Rovner |
| Previous by Thread: | Re: Re: accessing the python type systemi: 00344, Stefan Seefeld |
| Next by Thread: | wrong semantics in boost/python/cast.hpp?: 00344, Ralf W. Grosse-Kunstleve |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |