DBF records API

MRAB python at mrabarnett.plus.com
Sat Jun 2 06:49:12 EDT 2012


On 02/06/2012 06:16, Ethan Furman wrote:
> Tim Chase wrote:
>>  On 06/01/12 19:05, Jon Clements wrote:
>>>  On 01/06/12 23:13, Tim Chase wrote:
>>>>     dbf.scatter_fields
>>>>
>>>>  *always* trump and refer to the method.
>>>  I did think about *trumping* one way or the other, but both *ugh*.
>>
>>  For the record, it sounded like the OP wanted to be able to use the
>>  dot-notation for accessing fields by name, and I think it's a pretty
>>  non-pythonic way to do it.  I'd much rather just stick to purely
>>  using __getitem__ for the fields and attributes/methods for non-fields.
>
> It can't be *that* non-Pythonic -- we now have namedtuples which pretty
> much behave just like my record class (although its indexes are only
> numbers, not strings as well).
>
namedtuple prefixes its methods with "_", so you could just have:

     record.name

and:

     record._deleted



More information about the Python-list mailing list