6

I've seen the data types in the NumPy package of Python, but I found the description of the data type 'intp' a bit confusing. Its description is like:

  • intp: Integer used for indexing (same as C ssize_t; normally either int32 or int64)

Why is the word indexing used here if it is same as the ssize_t of C, as ssize_t is used to store the size of a variable?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sachin Sharma
  • 89
  • 1
  • 4
  • "why the word indexing is used here if it is same as the ssize_t of C" - I would say it is used because it is same as the ssize_t of C :-) 32bit on 32bit system, 64bit on 64bit system, maybe there is some use case.. – Jan Stránský Aug 25 '20 at 17:52
  • I've seen `intp` used in `cython` examples (and potentially other `c` interfaced code). There's no point in using it as a `dtype` in `numpy` python code. – hpaulj Aug 25 '20 at 20:31
  • @JanStránský What does it mean by indexing? – Sachin Sharma Aug 26 '20 at 03:26
  • Ok, so the actual question is "what does indexing mean in this context?"? – Jan Stránský Aug 26 '20 at 07:08
  • Does [this SO post](https://stackoverflow.com/a/35845707/2700104) answer your question? `ssize_t` is not "used to store the size of a variable", it is a size of a pointer, used in indexing the memory access – Jan Stránský Aug 26 '20 at 07:17

0 Answers0