[starting new thread to not pollute the summary thread]

On 04/28/2013 11:54 PM, Antoine Pitrou wrote:> On Sun, 28 Apr 2013 17:29:35 
-0700
Ethan Furman <et...@stoneleaf.us> wrote:

Not only is this inconsistent with the rest of Python*, but it's going to be a 
PITA for data storage/retrieval:

      datastore = dbf.Table('storage.dbf', 'event_name C(50); date D; season 
SEASON')

      def retrieve_record(...):
          result = []
          for field_type, field_data in record:
              result.append(field_type(field_data))

I've never seen any kind of "data retrieval" which works like that.
Would you care to explain us the context?

The more specific context would be my dbf package, which works with dBase III, Clipper, and Foxpro tables. When the fields of a record are requested they are transformed into Python data types, with code that looks pretty much like that retrieve_record snippet (w/o all the error checks, etc.). And no, it doesn't support enumerations (yet).

A more general context would be anywhere that you need to convert the integer offset of an enum item back into the enum item itself; you may have gotten the integer offset from a postgres database, or an RPC call, and it seems to me the natural way get the enum item from that is with `EnumClass(offset)`.

--
~Ethan~
_______________________________________________
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