Re: Looking for the best way to translate an idiom

2008-12-15 Thread Bruno Desthuilliers
Aahz a écrit : In article gi4834$la...@zinnia.noc.ucla.edu, James Stroud jstr...@mbi.ucla.edu wrote: In case its not obvious: Ah, so that's where Bruno's extra apostrophe came from! ;-) Err... Which one exactly ? (Sorry about the spelling flame, but seeing three posts in quick

Re: Looking for the best way to translate an idiom

2008-12-15 Thread Aahz
In article 494611c2$0$21934$426a3...@news.free.fr, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Aahz a écrit : In article gi4834$la...@zinnia.noc.ucla.edu, James Stroud jstr...@mbi.ucla.edu wrote: In case its not obvious: Ah, so that's where Bruno's extra

Re: Looking for the best way to translate an idiom

2008-12-15 Thread Steve Holden
James Stroud wrote: Aahz wrote: In article gi4834$la...@zinnia.noc.ucla.edu, James Stroud jstr...@mbi.ucla.edu wrote: In case its not obvious: Ah, so that's where Bruno's extra apostrophe came from! ;-) (Sorry about the spelling flame, but seeing three posts in quick succession with

Re: Looking for the best way to translate an idiom

2008-12-15 Thread MRAB
James Stroud wrote: Aahz wrote: In article gi4834$la...@zinnia.noc.ucla.edu, James Stroud jstr...@mbi.ucla.edu wrote: In case its not obvious: Ah, so that's where Bruno's extra apostrophe came from! ;-) (Sorry about the spelling flame, but seeing three posts in quick succession with

Looking for the best way to translate an idiom

2008-12-14 Thread Paul Moore
I'm translating some code from another language (Lua) which has multiple function return values. So, In Lua, it's possible to define a function function f() return 1,2,3 end which returns 3 values. These can then be used/assigned by the caller: a,b,c = f() So far, much like

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Bruno Desthuilliers
Paul Moore a écrit : I'm translating some code from another language (Lua) which has multiple function return values. So, In Lua, it's possible to define a function function f() return 1,2,3 end which returns 3 values. These can then be used/assigned by the caller: a,b,c =

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Paul Moore
On 14 Dec, 16:22, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: if you only want the first returned value, you can just apply a slice: def f():     return 1,2,3 a = f()[0] + 1 Hmm, true. I'm not sure it's any less ugly, though :-) FWIW, Python 2.6 has NamedTuple

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Steve Holden
Bruno Desthuilliers wrote: [...] if you only want the first returned value, you can just apply a slice: def f(): return 1,2,3 a = f()[0] + 1 nitThat isn't a slice, it's indexing/nit regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Bruno Desthuilliers
Steve Holden a écrit : Bruno Desthuilliers wrote: [...] if you only want the first returned value, you can just apply a slice: def f(): return 1,2,3 a = f()[0] + 1 nitThat isn't a slice, it's indexing/nit Yeps, sorry - and thanks for the correction. --

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Lie Ryan
On Sun, 14 Dec 2008 09:51:03 -0800, Paul Moore wrote: On 14 Dec, 16:22, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: if you only want the first returned value, you can just apply a slice: def f():     return 1,2,3 a = f()[0] + 1 Hmm, true. I'm not sure it's any

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Fuzzyman
On Dec 14, 5:51 pm, Paul Moore p.f.mo...@gmail.com wrote: On 14 Dec, 16:22, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: if you only want the first returned value, you can just apply a slice: def f():     return 1,2,3 a = f()[0] + 1 Hmm, true. I'm not sure

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
Paul Moore wrote: I'm translating some code from another language (Lua) which has multiple function return values. So, In Lua, it's possible to define a function function f() return 1,2,3 end which returns 3 values. These can then be used/assigned by the caller: a,b,c =

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
James Stroud wrote: py class mytuple(tuple): def magic(self, astr): names = astr.split() for name, val in zip(names, self): globals()[name] = val ... py t = mytuple((1,2,3)) py t.magic('a b') py a 1 py b 2 James In case its not obvious: def f(): return mytuple((1,2,3))

Re: Looking for the best way to translate an idiom

2008-12-14 Thread drobi...@gmail.com
On Dec 14, 11:19 am, Paul Moore p.f.mo...@gmail.com wrote: I'm translating some code from another language (Lua) which has multiple function return values. So, In Lua, it's possible to define a function     function f()         return 1,2,3     end which returns 3 values. These can then

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
drobi...@gmail.com wrote: I'm baffled by this discussion. What's wrong with a, dontcare, dontcare2 = f() a = a + 1 Simple, clear, and correct. 1. This can't apply to a generalized f() that may return an arbitrary number of arguments = len(num_assignments_you_care_about). 2. The

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
James Stroud wrote: inspect.stack()[1][0].f_locals[name] = val I just double checked this. Because of the way locals are implemented in cPython, this won't have the desired affect. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Aahz
In article gi4834$la...@zinnia.noc.ucla.edu, James Stroud jstr...@mbi.ucla.edu wrote: In case its not obvious: Ah, so that's where Bruno's extra apostrophe came from! ;-) (Sorry about the spelling flame, but seeing three posts in quick succession with incorrect spelling of its/it's pushed me

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
Aahz wrote: In article gi4834$la...@zinnia.noc.ucla.edu, James Stroud jstr...@mbi.ucla.edu wrote: In case its not obvious: Ah, so that's where Bruno's extra apostrophe came from! ;-) (Sorry about the spelling flame, but seeing three posts in quick succession with incorrect spelling of

Re: Looking for the best way to translate an idiom

2008-12-14 Thread I V
On Sun, 14 Dec 2008 21:08:33 -0800, James Stroud wrote: Yes. I think it was the British who decided that the apostrophe rule for it would be reversed from normal usage relative to just about every other noun. I'm not sure the purpose--maybe it was to give compulsive proofreaders a raison

alt.possessive.its.has.no.apostrophe (was: Looking for the best way to translate an idiom)

2008-12-14 Thread Ben Finney
James Stroud jstr...@mbi.ucla.edu writes: Yes. I think it was the British who decided that the apostrophe rule for it would be reversed from normal usage relative to just about every other noun. Remember that “it” is a pronoun. I see no reversal: he she we theyme

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
I V wrote: On Sun, 14 Dec 2008 21:08:33 -0800, James Stroud wrote: Yes. I think it was the British who decided that the apostrophe rule for it would be reversed from normal usage relative to just about every other noun. I'm not sure the purpose--maybe it was to give compulsive proofreaders a