On Aug 14, 2006, at 7:32 PM, Guido van Rossum wrote:

> Methinks that as long as PyIntObject uses long (see intobject.h)
> there's no point in changing this to long.

I guess you meant "changing this to Py_ssize_t ".  I don't understand  
why the type used by PyIntObject is relevant here.  Range object's  
"start" is logically  an index, but int object's "ob_ival" is not.    
Since PyIntObject's is definition is exposed by Python.h, changing  
the type of ob_ival will probably break a lot of code.  This  
reasoning does not apply to the range object.

Since on most platforms ssize_t is the same as long, the choice  
between the two is just a matter of self-documenting code.  Speaking  
of which, I find it unfortunate that the name Py_ssize_t was selected  
for the typedef.  I would prefer Py_index_t.  The first time I saw  
Py_ssize_t, I did not notice the double 's' and thought it was an  
unsigned type.  On the second look, I've realized that it is signed  
and started wondering why not ptrdiff_t.  I understand that ssize_t  
is defined by POSIX as the return type of functions such as "read"  
that can return either size or -1 for error.  I don't think POSIX  
mandates sizeof(size_t) == sizeof(ssize_t), but I may be wrong.   I  
would agree that ptrdiff_t, although standard C, is not a very  
intuitive name, but ssize_t is even less clear. 
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to