[pyicu-dev] [PATCH] Add correct namespace declarations everywhere

Fredrik Roubert roubert at google.com
Tue Sep 11 12:10:10 PDT 2007


On 9/11/07, Steven R. Loomis <srl at icu-project.org> wrote:

> the namespace could b e icu or icu_3_8 depending on what the rename settings
> are, so I would not use icu:: statically

Let's take a look at the very first change in my namespace patch (all
changes are similiar). In revision 78 of locale.cpp it looks like
this:


static PyObject *t_locale_getAvailableLocales(PyTypeObject *type)
{
    int count;
    const icu::Locale *locales = icu::Locale::getAvailableLocales(count);
    PyObject *dict = PyDict_New();

    for (int32_t i = 0; i < count; i++) {
        Locale *locale = (Locale *) locales + i;
        PyObject *obj = wrap_Locale(locale, 0);
        PyDict_SetItemString(dict, locale->getName(), obj);
	Py_DECREF(obj);
    }

    return dict;
}


As you can see, on the first line where Locale is referenced it is
prefixed with icu:: and on the second line where it's referenced it is
not prefixed. When I first saw this, I just assumed it to be a typo
that had been left there just because no-one noticed before. So I
created this patch that adds icu:: (consistent with the rest of the
code) to all places where I found it to be missing.

Why are you opposing this change? Are you quite sure that there is a
good reason to keep the code like it is above?

-- 
Fredrik Roubert
roubert at google.com


More information about the pyicu-dev mailing list