Ask Your Question
0

Using ClonableIntArray [closed]

asked 2024-12-22 20:20:04 +0100

CraigH gravatar image

I want to use ClonableIntArray for use with permutation groups. To do so, I created a thin wrapper class:

class IntArray(ClonableIntArray):
  def check(self):
    return

class IntArrays(UniqueRepresentation, Parent):
  def __init__(self):
    Parent.__init__(self, category = Sets())

  def _element_constructor_(self, *args, **keywords):
    Element = IntArray

Later, I define a (standard Python) list of ints vertex_vector and attempt to turn it into an IntArray via

ia = IntArrays()(vertex_vector)

. Printing them both out, I get [1,0,0,0] for vertex_vector, and None for ia. What am I doing wrong?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Max Alekseyev
close date 2024-12-23 21:08:32.889025

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-12-22 21:41:01 +0100

CraigH gravatar image

Never mind, figured it out. I had accidentally deleted a line from _element_constructor. It should read

class IntArrays(UniqueRepresentation, Parent):
  def __init__(self):
    Parent.__init__(self, category = Sets())

  def _element_constructor_(self, *args, **keywords):
    return self.element_class(self, *args, **keywords)

  Element = IntArray
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2024-12-22 20:20:04 +0100

Seen: 11 times

Last updated: yesterday