Tuesday, 15 July 2014

Python array combining -


I'm trying to close some Python code in Java. I am not familiar with Python and have never seen it before in any language:

  return [c,] + s   

What does it mean? Particularly [C,] Is it adding two array or something? S is an array of integers and c is integer Full function is below (from Wikipedia)

  DIF signal (self, m, z): self Urine (m) s, u = [none] * self N, random Randint (0, shelf) c = v = self. For e (u) i in category (z + 1, self.n) + category (z): s [i] = random.randint (0, auto.) V = self.E (v ^ self.g (S [i], self.k [i] .e, self.k [i] .n) if (i + 1)% self.n == 0: c = vs [z] = self.g (v ^ U, self.k [z] .d, self.k [z] .n) return [c,] + s   

Thanks a lot!

Comma is unnecessary It's just making an element list:

  & gt; & gt; > [1,] [1]>> [1] == [1,] is true   

practice tuples Comes from making Python; an element requires a comma as a comma Is:

 > (1) 1>>>> (1,) (1,)>> <1>> gt; & gt; ; (1) == (1,) Incorrect   

[c,] + s statement c as the first element.

No comments:

Post a Comment