Marko Rauhamaa :
> operator.add(x, y) [...] leaves x and y intact and must return a new
> object.
Well, if the addition doesn't modify x, the method can of course return
x.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
John O'Hagan :
> The weirdest part for me is this:
>
t = ([],)
l = t[0]
l is t[0]
> True
l += [1]
t[0] += [1]
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: 'tuple' object does not support item assignment
>
> Whether there is an error or not dep
On Mon, 16 Dec 2013 11:30:13 +0800
liuerfire Wang wrote:
> Just like below:
>
> In [1]: a = ([], [])
>
> In [2]: a[0].append(1)
>
> In [3]: a
> Out[3]: ([1], [])
>
> In [4]: a[0] += [1]
> ---
> TypeError
On Monday, December 16, 2013 9:27:11 AM UTC+5:30, Chris Angelico wrote:
> On Mon, Dec 16, 2013 at 2:30 PM, liuerfire Wang wrote:
> > TypeError: 'tuple' object does not support item assignment
> > In [5]: a
> > Out[5]: ([1, 1], [])
> > no problem, there is an exception. But a is still changed.
> >
On Mon, Dec 16, 2013 at 2:30 PM, liuerfire Wang wrote:
> TypeError: 'tuple' object does not support item assignment
>
> In [5]: a
> Out[5]: ([1, 1], [])
>
> no problem, there is an exception. But a is still changed.
>
> is this a bug, or could anyone explain it?
It's not a bug, but it's a bit con
Just like below:
In [1]: a = ([], [])
In [2]: a[0].append(1)
In [3]: a
Out[3]: ([1], [])
In [4]: a[0] += [1]
---
TypeError Traceback (most recent call last)
in ()
> 1 a[0] += [1]
TypeEr
Hi.
Does anyone know if pyclutter has a mailing list?
Regards.
Cristian Abarzúa
--
http://mail.python.org/mailman/listinfo/python-list
2010/9/2 Alban Nona
> Hello Xavier, working great ! thank you very much ! :p
> Do you know by any chance if dictionnary can be sorted asthis:
>
Look at the sorted() global function in the Python API. ;]
Cheers,
Xav
--
http://mail.python.org/mailman/listinfo/python-list
On 01/09/2010 17:49, Alban Nona wrote:
Hello Xavier,
Thank you :)
Well what Iam trying to generate is that kind of result:
listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS',
'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE',
'ELM001_DPF', 'ELM001_SDW', 'ELM001_
On 2 September 2010 02:49, Alban Nona wrote:
> Well what Iam trying to generate is that kind of result:
>
> listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS',
> 'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE',
> 'ELM001_DPF', 'ELM001_SDW', 'ELM001_MAT', 'ELM001_
Hello Xavier,
Thank you :)
Well what Iam trying to generate is that kind of result:
listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS',
'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE',
'ELM001_DPF', 'ELM001_SDW', 'ELM001_MAT', 'ELM001_WPP']
listn2 = ['ELM002_DI
On 2 September 2010 01:11, Alban Nona wrote:
> Hello,
>
> seems to have the same error with python.
> In fact I was coding within nuke, a 2d compositing software (not the best)
> unfortunately, I dont see how I can use dictionnary to do what I would like
> to do.
>
Hello Alban,
The reason it's
Hello,
seems to have the same error with python.
In fact I was coding within nuke, a 2d compositing software (not the best)
unfortunately, I dont see how I can use dictionnary to do what I would like
to do.
2010/9/1 Xavier Ho
> On 2 September 2010 00:47, Alban Nona wrote:
>
>> Hello,
>>
>> So
On 2 September 2010 00:47, Alban Nona wrote:
> Hello,
>
> So I figure out this night how to create automatically varibales via
> vars(), the script seems to work, exept that where it should give me a list
> like :
> [ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB,
> etc...]
Hello,
So I figure out this night how to create automatically varibales via vars(),
the script seems to work, exept that where it should give me a list like :
[ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB,
etc...] it gave me just one entry in my list, and the last one [ELM0
On 1 September 2010 12:00, Alban Nona wrote:
> @Xavier: ShaDoW, WorldPositionPoint (which is the same thing as
> WordPointCloud passe) :)
>
Aha! That's what I was missing.
Cheers,
Xav
--
http://mail.python.org/mailman/listinfo/python-list
In fact, the First list (wich contain "Elm001, Elm002, Elm003) will be
generated automatically from files that I have in a directory, that's why I
cant write the same code for Elm002, 003, etc... Because Ill not know how
many Elm there will be.
2010/8/31 MRAB
> On 01/09/2010 03:00, Alban Nona w
On 01/09/2010 03:00, Alban Nona wrote:
@MRAB, thank you, but what if there are like 40 entries like 'Elem00x' ?
is there a way to do it automaticaly ?
If you can do it for 'Elem001', I'm sure you could write some code to
produce a list of 'Elem001', 'Elem002', etc, and check whether any are
sub
@MRAB, thank you, but what if there are like 40 entries like 'Elem00x' ? is
there a way to do it automaticaly ?
@Xavier: ShaDoW, WorldPositionPoint (which is the same thing as
WordPointCloud passe) :)
Anyway, thank you !
2010/8/31 Xavier Ho
> On 1 September 2010 07:57, Alban Nona wrote:
>
>>
On 1 September 2010 07:57, Alban Nona wrote:
> listPass = ["DIF","SPC", "RFL", "SSS", "REFR", "ALB", "AMB", "NRM", "MVE",
> "DPF", "SDW", "MAT", "WPP"]
>
Out of curiosity, could you briefly mention what "SDW" and "WPP" passes are?
I've worked out the rest, and these two are riddling my brain.
(
On 31/08/2010 22:57, Alban Nona wrote:
Just Another Question on this one, Im trying to create that kind of
thing in code now:
#GENERE ET INCREMENT LE NOM DES ELEMENTS
val = 0
list = ["0", "1", "2", "3"]
listEl = []
for n in list:
val = val + 1
next = "00" +str(val)
elem
Just Another Question on this one, Im trying to create that kind of thing in
code now:
#GENERE ET INCREMENT LE NOM DES ELEMENTS
val = 0
list = ["0", "1", "2", "3"]
listEl = []
for n in list:
val = val + 1
next = "00" +str(val)
elem = "ELM"+next
listEl.append(elem)
#I
Well, I have a lot to learn :)
Thank you very much both of you ! it seems to work now :p
2010/8/31 MRAB
> On 31/08/2010 20:20, Alban Nona wrote:
>
>> Ok, here a solution:
>>
>> myFirstList = ["FN067_098_MEN", "FN067_098_JIN", "FN067_098_BG"]
>>
>> mySecondList =
>>
>> ["FN067_098_MEN_Hair_PUZ_v
On Wed, Sep 1, 2010 at 12:27 AM, Alban Nona wrote:
> Hi all,
>
> Im stuck on this problem:
> I have a function which return me a list of string (basically the result
> looks like: ["FN067_098_MEN", FN067_098_JIN", FN067_098_BG"]
> In other hand, I have another list full of that kind of entries:
>
On 31/08/2010 20:20, Alban Nona wrote:
Ok, here a solution:
myFirstList = ["FN067_098_MEN", "FN067_098_JIN", "FN067_098_BG"]
mySecondList =
["FN067_098_MEN_Hair_PUZ_v001.0001.exr","FN067_098_JIN_Hair_SPC_v001.0001.exr","FN067_098_MEN_Jin_MVE_v001.0001.exr","FR043_010_GEN_NRM_v001.0001.exr"]
fo
On Tue, Aug 31, 2010 at 12:20 PM, Alban Nona wrote:
> Ok, here a solution:
> for n in myFirstList:
> var = str(n)
n is already a string, so the previous line doesn't do anything useful.
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On 31/08/2010 19:57, Alban Nona wrote:
Hi all,
Im stuck on this problem:
I have a function which return me a list of string (basically the result
looks like: ["FN067_098_MEN", FN067_098_JIN", FN067_098_BG"]
In other hand, I have another list full of that kind of entries:
["FN067_098_MEN_Hair_PUZ
Ok, here a solution:
myFirstList = ["FN067_098_MEN", "FN067_098_JIN", "FN067_098_BG"]
mySecondList =
["FN067_098_MEN_Hair_PUZ_v001.0001.exr","FN067_098_JIN_Hair_SPC_v001.0001.exr","FN067_098_MEN_Jin_MVE_v001.0001.exr","FR043_010_GEN_NRM_v001.0001.exr"]
for n in myFirstList:
var = str(n)
Hi all,
Im stuck on this problem:
I have a function which return me a list of string (basically the result
looks like: ["FN067_098_MEN", FN067_098_JIN", FN067_098_BG"]
In other hand, I have another list full of that kind of entries:
["FN067_098_MEN_Hair_PUZ_v001.0001.exr","FN067_098_JIN_Hair_SPC_v
On Fri, Apr 16, 2010 at 15:16, Terry Reedy wrote:
> On 4/16/2010 9:41 AM, J wrote:
>>
>> Ok... I know pretty much how .extend works on a list... basically it
>> just tacks the second list to the first list... like so:
>>
> lista=[1]
> listb=[2,3]
> lista.extend(listb)
> print lista
On 4/16/2010 9:41 AM, J wrote:
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
This shows right here that lista is extended in place. If you are not
On Sat, 2010-04-17 at 00:37 +1000, Lie Ryan wrote:
> On 04/16/10 23:41, J wrote:
> > So, what I'm curious about, is there a list comprehension or other
> > means to reduce that to a single line?
>
> from itertools import chain
> def printout(*info):
> print '\n'.join(map(str, chain(*info)))
>
On 04/16/10 23:41, J wrote:
> Ok... I know pretty much how .extend works on a list... basically it
> just tacks the second list to the first list... like so:
>
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
> [1, 2, 3]
>
> what I'm confused on is why this returns None:
J a écrit :
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
So why the None? Is this because what's
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
>>> lista=[1]
>>> listb=[2,3]
>>> lista.extend(listb)
>>> print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
>>> lista=[1]
>>> listb=[2,3]
>>> print li
Nathan Rice wrote:
> I was just wondering, why the list/generator and standard "for" have
> disparities?
>
> It would be really nice to be able to do:
>
> for x in y if foo:
> ...
>
> rather than:
>
> for x in (x for x in y if foo):
> ...
>
But it's not much of an issue when you can ea
I was just wondering, why the list/generator and standard "for" have
disparities?
It would be really nice to be able to do:
for x in y if foo:
...
rather than:
for x in (x for x in y if foo):
...
Also, from a style standpoint, I prefer to extract the loop logic into a
function if it's
Thanks to all of you. You have been most helpful.
Regards,
Manuel Graune
--
A hundred men did the rational thing. The sum of those rational choices was
called panic. Neal Stephenson -- System of the world
http://www.graune.org/GnuPG_pubkey.asc
Key fingerprint = 1E44 9CBD DEE4 9E07 5E0A 5828 5
Manuel Graune wrote:
in (most) python documentation the syntax "list()"
and "[]" is treated as being more or less the same
thing.
Untrue. List() and [] happen to both evaluate to the same thing, an
empty list. But there is no reason to expect list() and
[] to always evaluate to the same thing
On Monday 30 November 2009 12:22:17 pm Manuel Graune wrote:
>
> when using local variables in list comprehensions, say
>
> a=[i for i in xrange(10)]
>
> the local variable is not destroyed afterwards:
[...]
> b=list(j for j in xrange(10))
>
> the local variable is destroyed after use:
Actually, []
On Mon, Nov 30, 2009 at 9:22 AM, Manuel Graune wrote:
> in (most) python documentation the syntax "list()"
> and "[]" is treated as being more or less the same
> thing. For example "help([])" and "help(list())" point
> to the same documentation. Since there are at least
> two cases where this simi
i should also mention that
a=[i for i in xrange(10)]
and
b=list(j for j in xrange(10))
isn't really just a difference of using [] vs. list()
the first case is a list comprehension, the second case is a generator
comprehension which is then converted to a list
(the bug only applies to list compr
Manuel Graune wrote:
> in (most) python documentation the syntax "list()"
> and "[]" is treated as being more or less the same
> thing. For example "help([])" and "help(list())" point
> to the same documentation. Since there are at least
> two cases where this similarity is not the case, (see belo
n xrange(10)]
the local variable is not destroyed afterwards:
print "a",a
print "i",i
using the similar code
b=list(j for j in xrange(10))
the local variable is destroyed after use:
print "b",b
print "j",j
It's not so much about list() vs. [] but ge
On Mon, Nov 30, 2009 at 12:22 PM, Manuel Graune wrote:
>
> Hello,
>
> in (most) python documentation the syntax "list()"
> and "[]" is treated as being more or less the same
> thing. For example "help([])" and "help(list())" point
> to the same documentation. Since there are at least
> two cases w
Hello,
in (most) python documentation the syntax "list()"
and "[]" is treated as being more or less the same
thing. For example "help([])" and "help(list())" point
to the same documentation. Since there are at least
two cases where this similarity is not the case, (see below)
can someone explain
Steven D'Aprano wrote:
> On Sun, 26 Nov 2006 00:25:13 -0800, hollowspook wrote:
>
> > Hi, there
> >
> > a = range(100)
> >
> > if I want to use No 7, 11, 56,90 in a, then the only way I do is [a[7],
> > a[11], a[56], a[90]].
> > Is there any other way?
>
> a = [7, 11, 56, 90]
>
> Are those numbers
hollowspook wrote:
> how about indexing 1-7, 10
> [range(1:8),10] will generate [[1, 2, 3, 4, 5, 6, 7], 10], instead of
> [1, 2, 3, 4, 5, 6, 7, 10]
>>> range(1,8)+[10]
[1, 2, 3, 4, 5, 6, 7, 10]
--
Under construction
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, bearophile.
range(1, 8) + [10] is great!
"[EMAIL PROTECTED] 写道:
"
> hollowspook:
> > how about indexing 1-7, 10
> > [range(1:8),10] will generate [[1, 2, 3, 4, 5, 6, 7], 10], instead of
> > [1, 2, 3, 4, 5, 6, 7, 10]
>
> (Note that range(1:8) is a syntax error).
>
> You can join and extend
hollowspook:
> how about indexing 1-7, 10
> [range(1:8),10] will generate [[1, 2, 3, 4, 5, 6, 7], 10], instead of
> [1, 2, 3, 4, 5, 6, 7, 10]
(Note that range(1:8) is a syntax error).
You can join and extend lists as you like:
>>> range(1, 8) + [10]
[1, 2, 3, 4, 5, 6, 7, 10]
See also the list.a
Thanks, John
how about indexing 1-7, 10
[range(1:8),10] will generate [[1, 2, 3, 4, 5, 6, 7], 10], instead of
[1, 2, 3, 4, 5, 6, 7, 10]
"John Machin 写道:
"
> hollowspook wrote:
> > Hi, there
> >
> > a = range(100)
> >
> > if I want to use No 7, 11, 56,90 in a, then the only way I do is [a[7],
> >
On Sun, 26 Nov 2006 00:25:13 -0800, hollowspook wrote:
> Hi, there
>
> a = range(100)
>
> if I want to use No 7, 11, 56,90 in a, then the only way I do is [a[7],
> a[11], a[56], a[90]].
> Is there any other way?
a = [7, 11, 56, 90]
Are those numbers supposed to be in some sort of series? They
hollowspook wrote:
> Hi, there
>
> a = range(100)
>
> if I want to use No 7, 11, 56,90 in a, then the only way I do is [a[7],
> a[11], a[56], a[90]].
> Is there any other way?
>
I presume a = range(100) is just an indication that a is a list -- the
literal answer to your question as asked is simpl
Hi, there
a = range(100)
if I want to use No 7, 11, 56,90 in a, then the only way I do is [a[7],
a[11], a[56], a[90]].
Is there any other way?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
Larry Bates wrote:
> [EMAIL PROTECTED] wrote:
>> Hello:
>> Variable 'a' has the next values:
>> [[1,1],[2,2]]
>> and I want to take a to b as:
>> [[1,1,'='],[2,2,'=']]
>> How can I do this with only one line of instruction?
>> Thanks!!
>>
> To copy a list use:
>
> b=a[:]
>
> -Larry
Seems I may ha
[EMAIL PROTECTED] wrote in news:1161102973.920895.141500
@i42g2000cwa.googlegroups.com:
> Hello:
> Variable 'a' has the next values:
> [[1,1],[2,2]]
> and I want to take a to b as:
> [[1,1,'='],[2,2,'=']]
> How can I do this with only one line of instruction?
> Thanks!!
>
b = [[x,y,'='] for (x,y
[EMAIL PROTECTED] wrote:
> Hello:
> Variable 'a' has the next values:
> [[1,1],[2,2]]
> and I want to take a to b as:
> [[1,1,'='],[2,2,'=']]
> How can I do this with only one line of instruction?
b = [item + ['='] for item in a]
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1
[EMAIL PROTECTED] wrote:
> Hello:
> Variable 'a' has the next values:
> [[1,1],[2,2]]
> and I want to take a to b as:
> [[1,1,'='],[2,2,'=']]
> How can I do this with only one line of instruction?
> Thanks!!
>
To copy a list use:
b=a[:]
-Larry
--
http://mail.python.org/mailman/listinfo/python-l
[EMAIL PROTECTED] wrote:
> Hello:
> Variable 'a' has the next values:
> [[1,1],[2,2]]
> and I want to take a to b as:
> [[1,1,'='],[2,2,'=']]
> How can I do this with only one line of instruction?
> Thanks!!
>>> a = [[1,1], [2,2]]
>>> map( lambda x: x + ['='], a )
[[1, 1, '='], [2, 2, '=']]
>>>
Hello:
Variable 'a' has the next values:
[[1,1],[2,2]]
and I want to take a to b as:
[[1,1,'='],[2,2,'=']]
How can I do this with only one line of instruction?
Thanks!!
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Shi Mu wrote:
>
>>How to run a function to make [1,2,4] become [[1,2],1,4],[2,4]]?
>>Thanks!
>
>
> You want [[1,2],[1,4],[2,4]]? That is, all combinations of 2 items
> from
> the list? You might want to look at:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Reci
Shi Mu wrote:
> How to run a function to make [1,2,4] become [[1,2],1,4],[2,4]]?
> Thanks!
You want [[1,2],[1,4],[2,4]]? That is, all combinations of 2 items
from
the list? You might want to look at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
>>> import * from xpermutations
Shi Mu wrote:
> How to run a function to make [1,2,4] become [[1,2],1,4],[2,4]]?
> Thanks!
From what I gather try:
a = [1,2,4]
n = list()
for i in a:
index = a.index(i) + 1
for x in a[index:]:
n.append([i, x])
print n
more elegant ways to do this, but its a start.
hope this h
try to describe what you want as it is not very obvious, and has syntax
error.
Shi Mu wrote:
> How to run a function to make [1,2,4] become [[1,2],1,4],[2,4]]?
> Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
How to run a function to make [1,2,4] become [[1,2],1,4],[2,4]]?
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
65 matches
Mail list logo