I am trying to find a way to pass an object reference in python and type in a type similar to Java, but not use it. I duno if this topic exists somewhere here.
My problem is that I need to pass an object reference to the class constructor. But I duno how to give a method a link to an object. In java, although I do this, but I need to pass the code to the server.
Thank you very much jack
class SearchRectangle:
def __init__(self, lower_left_subgrid_x, lower_left_subgrid_y, rectangle_width, rectangle_height):
self.min_subgrid_x = int(lower_left_subgrid_x)
self.max_subgrid_x = int(self.min_subgrid_x + rectangle_width -1)
self.min_subgrid_y = int(lower_left_subgrid_y)
self.max_subgrid_y = int(self.min_subgrid_y + rectangle_height -1)
...blah
class SearchRectangleMultiGrid:
def __init__(self, parent_rectangle):
self.parent_rectangle = SearchRectangle()parent_rectangle
test_rect = SearchRectangle(test_subgrid.subgrid_x, test_subgrid.subgrid_y, 18, 18)
print "\n\nTest SearchRectangle";
print test_rect.to_string()
print test_rect.sql_clause
test_rec_multi = SearchRectangleMultiGrid(test_rect)
print "\n\nTest SearchRectangleMulti"
test_rec_multi.parent_rectangle.to_string()
source
share