A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-April/023643.html below:

[Python-Dev] re: PEP 279 revisited, formally

[Python-Dev] re: PEP 279 revisited, formallyTim Peters tim.one@comcast.net
Fri, 26 Apr 2002 11:58:06 -0400
[Guido]
> ...
> So enumerate() it is.  (Specifically not enum() because of the C/C++
> meaning of that word.)

The C/C++ meaning isn't a barrier to me:  a C enum decl without embedded '='
must associate 0 with the first name, 1 with the second name, and so on.
Indeed, if the Python enum returned pairs in (value, index) order,

    dict(enum(['apple', 'pear', 'godzilla'])

would create the dict

    {'apple': 0, 'pear': 1, 'godzilla': 2}

which is about as close to the C

    enum {apple, pear, godzilla};
    /* now apple==0, pear==1, godzilla==2 */

as you can get with a Python function.





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4