Dean Moldovan
b4498ef44d
Add py::isinstance<T>(obj) for generalized Python type checking
...
Allows checking the Python types before creating an object instead of
after. For example:
```c++
auto l = list(ptr, true);
if (l.check())
// ...
```
The above is replaced with:
```c++
if (isinstance<list>(ptr)) {
auto l = reinterpret_borrow(ptr);
// ...
}
```
This deprecates `py::object::check()`. `py::isinstance()` covers the
same use case, but it can also check for user-defined types:
```c++
class Pet { ... };
py::class_<Pet>(...);
m.def("is_pet", [](py::object obj) {
return py::isinstance<Pet>(obj); // works as expected
});
```
2016-11-17 08:55:42 +01:00
..
2016-11-15 12:38:05 +01:00
2016-09-07 01:25:27 +02:00
2016-11-06 19:12:48 +01:00
2016-09-06 13:02:29 +09:00
2016-09-23 01:40:22 +02:00
2016-09-07 01:25:27 +02:00
2016-09-09 03:04:09 -04:00
2016-09-09 03:04:09 -04:00
2016-09-03 17:34:41 -04:00
2016-08-19 13:19:38 +02:00
2016-09-06 16:41:50 +02:00
2016-09-19 13:43:43 +02:00
2016-09-13 20:40:28 +10:00
2016-09-28 00:59:21 +10:00
2016-10-20 16:19:58 +02:00
2016-09-06 12:22:13 -04:00
2016-09-03 17:34:41 -04:00
2016-08-19 13:19:38 +02:00
2016-10-20 21:32:55 +01:00
2016-10-20 21:32:55 +01:00
2016-11-15 12:38:05 +01:00
2016-11-15 12:38:05 +01:00
2016-09-06 13:02:29 +09:00
2016-08-25 17:08:09 +02:00
2016-11-16 17:28:11 +01:00
2016-11-16 17:28:11 +01:00
2016-08-19 16:31:48 +02:00
2016-09-10 12:08:32 +02:00
2016-08-19 16:31:48 +02:00
2016-09-16 08:04:15 +02:00
2016-09-16 08:04:15 +02:00
2016-11-17 08:55:42 +01:00
2016-11-17 08:55:42 +01:00
2016-11-07 15:59:01 +01:00
2016-11-07 15:59:01 +01:00
2016-09-07 01:25:27 +02:00
2016-08-19 13:19:38 +02:00
2016-09-06 16:41:50 +02:00
2016-09-19 13:43:43 +02:00
2016-11-01 11:44:57 +01:00
2016-11-01 11:44:57 +01:00
2016-09-03 17:34:41 -04:00
2016-08-19 13:19:38 +02:00
2016-10-20 16:19:58 +02:00
2016-09-19 13:45:31 +02:00
2016-11-16 17:53:37 +01:00
2016-10-28 01:02:46 +02:00
2016-11-01 13:29:32 +00:00
2016-11-03 09:35:05 +00:00
2016-09-07 01:25:27 +02:00
2016-08-19 13:19:38 +02:00
2016-09-03 17:34:41 -04:00
2016-09-19 13:43:43 +02:00
2016-09-03 17:34:41 -04:00
2016-08-19 13:19:38 +02:00
2016-10-11 22:13:02 +02:00
2016-10-11 22:13:02 +02:00
2016-11-15 22:24:26 +01:00
2016-11-15 22:24:26 +01:00
2016-11-13 10:41:31 +09:00
2016-08-24 23:30:00 +01:00
2016-10-20 16:19:58 +02:00
2016-09-04 18:23:55 -04:00
2016-11-15 12:30:38 +01:00
2016-11-15 12:30:38 +01:00
2016-09-11 01:21:53 -04:00
2016-09-11 01:21:53 -04:00