localization, is it slow ?

I used to think the same thing about using identifiers in Python in
general. For example, I wrote code to access fields from a database
lookup using a "constant" integer reference to a slot in a sequence:

(
FLD_NAME,
FLD_COUNTRY,
) = range(2)

data = ['Mark','USA']

print 'Name = %s' % data[FLD_NAME]

(The reason for using 'constants' was to allow for expansion without
breaking code with hard coded values - i.e. data[0])

rather than just putting the data in a dictionary using the field name
as the key

data = {'NAME' : 'Mark', 'COUNTRY' : 'USA'}

print 'Name = %s' % data['NAME']

Coming from a Pascal (Delphi) background, I figured that the former
approach had to be faster, by accessing the sequence member directly
rather than doing a dictionary lookup. However, playing around with
Python namespaces the other day, I realized that Python stores the
values of FLD_NAME and FLD_COUNTRY in a dictionary (see globals()) so
that the code is still doing a dictionary lookup. I ran a couple of
quick and dirty timing tests and discovered that the second approach,
while being easier to write was about 5 to 8 per cent faster.

Mark

ยทยทยท

On Sat, 2007-12-01 at 11:17 +0100, Stef Mientki wrote:

I was investigating the possibility to support multiple languages in my
application,
and found il8n.

From what I read, I understand that il8n is using the original string
as the identifier.
If that's true, isn't it incredibly slow ?
( I'm thinking of many help texts, each of several lines long)