First time here? Check out the FAQ!

Ask Your Question
0

Using ClonableIntArray [closed]

asked 0 years ago

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?

Preview: (hide)

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 0 years ago

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
Preview: (hide)
link

Question Tools

1 follower

Stats

Asked: 0 years ago

Seen: 56 times

Last updated: Dec 22 '24