# Pyffi : how to test type of numpy.ndarray

**URL:** <https://racket.discourse.group/t/pyffi-how-to-test-type-of-numpy-ndarray/4043>\
**Category:** General\
**Created:** [December 12, 2025, 10:50am UTC](https://racket.discourse.group/t/pyffi-how-to-test-type-of-numpy-ndarray/4043 "2025-12-12T10:50:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [December 12, 2025, 10:50am UTC](https://racket.discourse.group/t/pyffi-how-to-test-type-of-numpy-ndarray/4043/1 "2025-12-12T10:50:07Z")

</div>

Hi,

i want to test type of a variable to compare with numpy.ndarray, as far i tried:

```scheme
(builtins.type numpy.ndarray)
. . ../../../pyffi4python3.xx/pyffi/pyffi-lib/pyffi/python-attributes.rkt:191:7: rp: got: #<procedure:...fi/python-types.rkt:605:22>

```

so i made classic hack using strings:

```scheme
(define Z (numpy.array '[[0 0 0 0 0 0]
                         [0 0 0 1 0 0]
                         [0 1 0 1 0 0]
                         [0 0 1 1 0 0]
                         [0 0 0 0 0 0]
                         [0 0 0 0 0 0]]))

(string=? (format "~a" (builtins.type (numpy.array '(0)))) (format "~a" (builtins.type Z)))

#t

```

perhaps there is a more elegant way indeed with pyffi?

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [December 12, 2025, 11:00am UTC](https://racket.discourse.group/t/pyffi-how-to-test-type-of-numpy-ndarray/4043/2 "2025-12-12T11:00:02Z")

</div>

this ,is working:

```scheme
(builtins.isinstance Z (builtins.type (numpy.array '(0))))
#t

```

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [December 12, 2025, 11:03am UTC](https://racket.discourse.group/t/pyffi-how-to-test-type-of-numpy-ndarray/4043/3 "2025-12-12T11:03:12Z")

</div>

also this:

```scheme
Z. __class__. __name__"ndarray"

```

Great!
