[MERGE] Repository.iter_files_bytes()
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Mar 26 12:01:55 GMT 2009
>>>>> "Andrew" == Andrew Bennetts <andrew.bennetts at canonical.com> writes:
Andrew> Vincent Ladeuil wrote:
Andrew> [...]
>> Given that using '_' as an anonymous variable is a common idiom
>> in python, this conflicts hard with gettext reserving '_' for its
>> private usage by adding it to __global__ so that it can be
>> accessed anywhere without importing gettext again.
Andrew> I don't understand why that's such a big issue.
Because using '_' as an anonymous variable overrides the '_'
defined by gettext.
I don't remember the specifics right now, but if you restore bzr
and bzr-gtk before the mentioned patch you should be able to
reproduce the problem.
The thread that should contain the most relevant info is at
https://lists.canonical.com/archives/bzr-gtk/2008-January/000417.html.
Andrew> How many functions both use '_' as an anonymous
Andrew> variable *and* want to use gettext?
The problem wasn't in functions that were using both, but indeed
the side-effect of one function using '_' as an anonymous and the
other using '_' as per gettext definition.
Which made it hard to debug since you had to execute the former
before the later or the bug didn't manifest itself.
Andrew> The small minority that do can use your workaround of
Andrew> importing gettext.gettext directly, or is the problem
Andrew> that xgettext doesn't provide a way to cope with two
Andrew> possible keywords? Or does xgettext not cope with
Andrew> “_” sometimes not being used as a gettext function?
I can't remember, sorry.
<snip/>
Andrew> Huh? It sounds like you're saying that code like:
Andrew> # foo.py
Andrew> x = 1
Andrew> def func():
Andrew> x = 2
Andrew> func()
Andrew> print x == 1
Andrew> would print False, which is clearly not the case in
Andrew> Python. Assignment in a function doesn't modify
Andrew> globals unless there is a “global” declaration in
Andrew> that function, or unless I'm missing some very nasty
Andrew> magic.
It seems it is nasty black magic indeed :)
Good hunt :)
Vincent
More information about the bazaar
mailing list