array in class
class A: this_is_original_variable_only_for_one_inctance = 0 def __init__(self, v): self.this_is_original_variable_only_for_one_inctance = v class B: this_is_common_for_all_instances = [] def __init__(self, v): self.this_is_common_for_all_instances.append(v) now I can create some instances of B, but all of them have the same array, why if I use append for b1.this_is_common_for_all_instances, the b2, b3 will have been changed that array. (where bi is instance of B) but changes on this_is_original_variable_only_for_one_inctance works fine why it does that? and how create array in class - normal array, "private variable" -- http://mail.python.org/mailman/listinfo/python-list
Graphical grammar in python
hi Is exist any graphical library with resize, rotate, shape recognition, ...? suitable for graphical grammar at this moment I have OpenGL (resize & rotate) and recognition solved as saved set of shapes (classes) feel free to write down any ideas :) -- http://mail.python.org/mailman/listinfo/python-list
what does int means for python ?
#!/usr/bin/env python arr = [[0 for c in range(0, 10)] for r in range(0, 10)] # 10x10 array arr[2,3] # throws TypeError: list indices must be integers arr[int(2), int(3)] # also throws TypeError: list indices must be integers ! - what is wrong in above script ? -- http://mail.python.org/mailman/listinfo/python-list
Re: what does int means for python ?
> > try arr[2][3] instead. > > basically your version is trying to index an array with a tuple argument > (2,3). > > --irmen oh, you're right. btw, is any simple way to create multi-dimension array ? any built-in function ? -- http://mail.python.org/mailman/listinfo/python-list