Re: class initialization problem

2009-09-19 Thread Tim Roberts
rantingrick wrote: > >WHY did i need do this you may ask? >I am creating geometry with OpenGL. When you create a face you must >specify a winding order (clockwise or counter clockwise) this winding >order controls which side of the face will be visible (since only one >side of a face is rendered).

Re: class initialization problem

2009-09-18 Thread Dave Angel
rantingrick wrote: On Sep 18, 12:24 am, "OKB (not okblacke)" wrote: Perhaps you want to cut off the recursion at the first step, so that the nested instance itself does not have a nested instance. If so, add another parameter to __init__ that flags whether you are creating a "top-le

Re: class initialization problem

2009-09-17 Thread Gabriel Genellina
En Fri, 18 Sep 2009 03:12:46 -0300, rantingrick escribió: I am creating geometry with OpenGL. When you create a face you must specify a winding order (clockwise or counter clockwise) this winding order controls which side of the face will be visible (since only one side of a face is rendered)

Re: class initialization problem

2009-09-17 Thread rantingrick
EDIT: copy.copy did work in a simple python interactive session, but it caused infinite recursion in my real world code? Anyway what ever is going on (probably lack of sleep!) the cure all was using an arg in the initial function. So now i am good as gold ;-) WHY did i need do this you may ask? I

Re: class initialization problem

2009-09-17 Thread Carl Banks
On Sep 17, 10:08 pm, rantingrick wrote: > On Sep 17, 11:54 pm, Carl Banks wrote: > > > > > > > On Sep 17, 8:27 pm, rantingrick wrote: > > > > ok i have a class and in it's constructor i want to create a copy of > > > it as an attribute, i have tried super, __new__, and noting seems to > > > work

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:31 pm, alex23 wrote: > On Sep 18, 3:08 pm, rantingrick wrote: > > > ok here is some code. this will cause an infinite recursion. > > > class A(): > >     def __init__(self, *args): > >         self.nestedA = A(*args) #NO GOOD! > > How about: > >   class A(object): >       def __init_

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:08 pm, rantingrick wrote: > ok here is some code. this will cause an infinite recursion. > > class A(): >     def __init__(self, *args): >         self.nestedA = A(*args) #NO GOOD! How about: class A(object): def __init__(self, first=True, *args): if first:

Re: class initialization problem

2009-09-17 Thread rantingrick
On Sep 18, 12:24 am, "OKB (not okblacke)" wrote: >         Perhaps you want to cut off the recursion at the first step, so > that the nested instance itself does not have a nested instance.  If so, > add another parameter to __init__ that flags whether you are creating a > "top-level" instance.

Re: class initialization problem

2009-09-17 Thread rantingrick
!SOLVED! Thanks for the help guys! copy.copy did it! Why does me makes life so hard on me? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: class initialization problem

2009-09-17 Thread OKB (not okblacke)
rantingrick wrote: > ok here is some code. this will cause an infinite recursion. > > class A(): > def __init__(self, *args): > self.nestedA = A(*args) #NO GOOD! > > there must be a way to create an instance of an object within the > same objects constructor? This is an inhe

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:08 pm, rantingrick wrote: > ok here is some code. this will cause an infinite recursion. > > class A(): >     def __init__(self, *args): >         self.nestedA = A(*args) #NO GOOD! > > there must be a way to create an instance of an object within the same > objects constructor? But i

Re: class initialization problem

2009-09-17 Thread rantingrick
On Sep 17, 11:54 pm, Carl Banks wrote: > On Sep 17, 8:27 pm, rantingrick wrote: > > > ok i have a class and in it's constructor i want to create a copy of > > it as an attribute, i have tried super, __new__, and noting seems to > > work, please help! > > > class A(base): > >     def __init__(self

Re: class initialization problem

2009-09-17 Thread Carl Banks
On Sep 17, 8:27 pm, rantingrick wrote: > ok i have a class and in it's constructor i want to create a copy of > it as an attribute, i have tried super, __new__, and noting seems to > work, please help! > > class A(base): >     def __init__(self): >         super(A, self).__init__() >         self.

Re: class initialization problem

2009-09-17 Thread rantingrick
On Sep 17, 11:14 pm, alex23 wrote: > On Sep 18, 1:27 pm, rantingrick wrote: > > > ok i have a class and in it's constructor i want to create a copy of > > it as an attribute, i have tried super, __new__, and noting seems to > > work, please help! > > > class A(base): > >     def __init__(self): >

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 1:27 pm, rantingrick wrote: > ok i have a class and in it's constructor i want to create a copy of > it as an attribute, i have tried super, __new__, and noting seems to > work, please help! > > class A(base): >     def __init__(self): >         super(A, self).__init__() >         self.

class initialization problem

2009-09-17 Thread rantingrick
ok i have a class and in it's constructor i want to create a copy of it as an attribute, i have tried super, __new__, and noting seems to work, please help! class A(base): def __init__(self): super(A, self).__init__() self.nested = ? think of a nested list [ [] ] but with obje