Greg Ewing wrote:
> Ronald Oussoren wrote:
>> No. Four-character-constants are *not* strings or byte arrays, they  are 
>> integer literals.
> 
> Well, in Pascal they were character arrays -- it
> was only when they switched to C that they became
> ints. Conceptually they're still the same thing.
> Python isn't C, and doesn't have to be bound by
> C's limitations.

Regardless of what the situation was in Pascal's time, they are 
currently integers.

The order of bytes in the array would need to be adjusted depending on 
the machine endianness to be correct.

The C argument passing convention is different for byte arrays than for 
integers (presumably the most common use of these constants is to use 
them with Apple libraries).

Different constants within the same enumeration are sometimes specified 
as decimal integers, and sometimes as character constants.  For example, 
the QTNewGWorldFromPtr function uses an enumeration which includes 
k32BGRAPixelFormat, defined as 'BGRA', and k32ARGBPixelFormat, defined 
as 0x20.

Providing a convenience str() method may be handy, but the internal 
representation must be integer.

Alex.

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to