Carl Karsten wrote:
Given this little example, would you still not worry about trailing
whitespace?
Oh yeah, that.
--> "abc ".strip()
'abc'
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.
~Ethan~
_______________________________________________
DB-SIG maillist - DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig