This is a static archive of the Python wiki, which was retired in February 2026 due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

By convention, Apple uses four character codes in place of integer enumerations in almost all of its software, protocols, and file formats.

Notes:

Examples:

In Python, four character codes are passed around as four character str (primarily for introspection purposes). Some Python code will automatically interchange four character codes with str, unicode, int, or long but that will not be the general case until Python 2.4 at the earliest. ../bgen may output constants that look like FOUR_CHAR_CODE('shor'), however FOUR_CHAR_CODE is (currently) a no-op and just returns the input string unchanged.

In C, four character codes are interchangable with 32 bit integer types and will usually be defined in an enumerator:

/*  
    This is how you will see them in Universal Interfaces format 
*/
enum {
    MyConstant = FOUR_CHAR_CODE('MooV'),
    MyOtherConstant = FOUR_CHAR_CODE('©xxx')
}

/*  
    This is the "new way" that you will see in OS X frameworks
*/
enum {
    MyConstant = 'MooV',
    MyOtherConstant = (long)0xA9787878 /* so that the source isn't tainted with high ascii */
}

See also:


2026-02-14 16:09