On Mon, Feb 25, 2013 at 3:17 PM, Glyph <gl...@twistedmatrix.com> wrote:

>
> On Feb 25, 2013, at 12:32 PM, Barry Warsaw <ba...@python.org> wrote:
>
> Dumb question, but are flufl.enums ordered?  That's also an important use
> case.
>
>
> Kind of.  Ordered comparisons are explicitly not supported, but iteration
> over
> the Enum is guaranteed to be returned in int-value order.
>
>
> Sorry to jump in to a random leaf of this thread, but there is such a
> barrage here I cannot find the beginning :).
>
> I can see in <http://www.python.org/dev/peps/pep-0435/#acknowledgments>
> that Twisted is mentioned; it should probably reference <
> https://twistedmatrix.com/documents/current/api/twisted.python.constants.html>
> and <https://twistedmatrix.com/documents/current/core/howto/constants.html>
> since we actually implemented a thing as well.
>
> (You can order constants by sorting them; off the top of my head,
> NamedConstant, ValueConstant, and FlagConstant all probably behave
> differently.)
>
>
Glyph, thanks for the input. I mentioned Twisted because in its code I
found a number of places with simple string enumerations used to represent
state. I was not aware of twisted.python.constants, but it doesn't appear
that this module is used  at least in the places I checked.

Examples:

* twisted/web/_newclient.py
* twisted/web/http.py
* twisted/protocol/sip.py

In general, many protocols have some "state" instance var that's usually
just a string, using either predefined constants or direct string literals.

Eli
_______________________________________________
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