Re: Looking for the best way to translate an idiom

2008-12-15 Thread Steve Holden
James Stroud wrote: > Aahz wrote: >> In article , >> James Stroud 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 push

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 wrote: >Aahz a écrit : >> In article , >> James Stroud wrote: >>> >>> In case its not obvious: >> >> Ah, so that's where Bruno's extra apostrophe came from! ;-) > >Err... Which one exactly ? Don't remember, it was a pos

Re: Looking for the best way to translate an idiom

2008-12-15 Thread MRAB
James Stroud wrote: Aahz wrote: In article , James Stroud 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 into making a pu

Re: Looking for the best way to translate an idiom

2008-12-15 Thread Bruno Desthuilliers
Aahz a écrit : In article , James Stroud 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 succession with incorrect spelling of its/it's pushed me into

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 r

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

2008-12-14 Thread Ben Finney
James Stroud 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 you it

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

Re: Looking for the best way to translate an idiom

2008-12-14 Thread James Stroud
Aahz wrote: In article , James Stroud 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 into making a public comment.) Yes.

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Aahz
In article , James Stroud 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 into making a public comment.) -- Aahz (a...@pyth

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 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 examp

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 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/ass

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 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 = f()

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Fuzzyman
On Dec 14, 5:51 pm, Paul Moore wrote: > On 14 Dec, 16:22, 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 > > Hmm, true. I'm not sure it's any less ugly, though :-) > > > FWIW, Pyth

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 > 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 :-) >

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 That isn't a slice, it's indexing Yeps, sorry - and thanks for the correction. -- http://mail.python.org/mailman/listinfo/p

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 > That isn't a slice, it's indexing regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC ht

Re: Looking for the best way to translate an idiom

2008-12-14 Thread Paul Moore
On 14 Dec, 16:22, 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 Hmm, true. I'm not sure it's any less ugly, though :-) > FWIW, Python 2.6 has NamedTuple objects... I know, but I want to targ

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 =

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