Re: [Zope-dev] Constant values defined in interfaces

2009-04-05 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris McDonough wrote: Using an interface class for a constant container would often be handy but it might be an inappropriate use of interface classes. FTR, I do often put constants in an interfaces.py module at module scope (if there are more

Re: [Zope-dev] Constant values defined in interfaces

2009-04-05 Thread Chris McDonough
Tres Seaver wrote: Chris McDonough wrote: Using an interface class for a constant container would often be handy but it might be an inappropriate use of interface classes. FTR, I do often put constants in an interfaces.py module at module scope (if there are more than one related,

Re: [Zope-dev] Constant values defined in interfaces

2009-04-04 Thread Chris Rossi
On Fri, Apr 3, 2009 at 7:21 PM, Wichert Akkerman wich...@wiggy.net wrote: Previously Chris Rossi wrote: I was wondering if the Zope collective had given any consideration to allowing constants to be defined in interfaces. To be clear, these are constant values that make up the protocol

Re: [Zope-dev] Constant values defined in interfaces

2009-04-04 Thread Chris McDonough
Using an interface class for a constant container would often be handy but it might be an inappropriate use of interface classes. FTR, I do often put constants in an interfaces.py module at module scope (if there are more than one related, sometimes in a dictionary or within a non-interface class

Re: [Zope-dev] Constant values defined in interfaces

2009-04-04 Thread Chris Rossi
On Sat, Apr 4, 2009 at 6:04 PM, Chris McDonough chr...@plope.com wrote: Using an interface class for a constant container would often be handy but it might be an inappropriate use of interface classes. I would argue that it is appropriate, but that's probably related to my experience with

Re: [Zope-dev] Constant values defined in interfaces

2009-04-04 Thread Shane Hathaway
Chris McDonough wrote: FTR, I do often put constants in an interfaces.py module at module scope (if there are more than one related, sometimes in a dictionary or within a non-interface class statement) in order to not feel I need to create some constants.py module. Maybe we could just agree

Re: [Zope-dev] Constant values defined in interfaces

2009-04-04 Thread Martin Aspeli
Chris Rossi wrote: from zope.interface import Constant class IHttpResponse(Interface): Models an HTTP 1.1 response. HTTP_OK = Constant(200 Ok, An HTTP Ok response.) HTTP_NOT_FOUND = Constant(404 Not Found, An HTTP Not Found response) status = Attribute(HTTP status

[Zope-dev] Constant values defined in interfaces

2009-04-03 Thread Chris Rossi
Hello, I was wondering if the Zope collective had given any consideration to allowing constants to be defined in interfaces. To be clear, these are constant values that make up the protocol defined by the interface. Just to have a concrete example, let's say we're modeling an http response:

Re: [Zope-dev] Constant values defined in interfaces

2009-04-03 Thread Gary Poster
On Apr 3, 2009, at 12:35 PM, Chris Rossi wrote: Hello, Hi Chris. I was wondering if the Zope collective had given any consideration to allowing constants to be defined in interfaces. To be clear, these are constant values that make up the protocol defined by the interface. ...

Re: [Zope-dev] Constant values defined in interfaces

2009-04-03 Thread Wichert Akkerman
Previously Chris Rossi wrote: I was wondering if the Zope collective had given any consideration to allowing constants to be defined in interfaces. To be clear, these are constant values that make up the protocol defined by the interface. Just to have a concrete example, let's say we're

Re: [Zope-dev] Constant values defined in interfaces

2009-04-03 Thread Gary Poster
On Apr 3, 2009, at 7:21 PM, Wichert Akkerman wrote: This looks like a poor man's enum. I'ld prefer to have a proper enum like thing. Seems a little different to me. For what it is worth, though, if you do want an enum in zope.schema, Canonical has lazr.enum: