[DB-SIG] dBase III and VFP tables
ethan at stoneleaf.us
Wed Jul 20 20:46:04 CEST 2011
Carl Karsten wrote:
>> Given this little example, would you still not worry about trailing
> Oh yeah, that.
>--> "abc ".strip()
> if rec.full_name.strip() == 'John Doe'
> Personally, I would leave it at that.
> half baked idea: If you want to add some code to hide that, add some
> sort of auto-strip to the driver so it drops the extra spaces.
Heh, that's what I've been doing. It did two things for me: 1) made
equality checking easier; and 2) made boolean checks make sense. It has
its own problems though -- mainly that single character empty fields
don't work well:
if rtyp in 'FMU': # is this Forwardable, Moved, or Undeliverable?
' ' gets stripped down to '', and '' is in every string, this doesn't work.
And yes, I could use a .strip() every time I have a field comparison,
but I have *lots* of them in my code, and it feels an awful lot like
unnecessary boiler plate.
Okay, I'll leave the default at str, and make Char, like Date, DateTime,
and Logical, be available options.
More information about the DB-SIG