Am 18.10.2010 16:35, schrieb f...@slick.airforce-one.org:
> So my way of coding it is the following:
> 
> class zone(GtkDrawingArea):
> 
>   class systemOfCoordinates:
>     self.xmin = -5
>     self.xmax = 5
>     self.ymin = -5
>     self.ymax = 5
> 
>   class Curve:
>     self.listOfPoints = ()
> 
>     def draw(self):
>       pass
>       # for each point in self.listOfPoints: draw this point
>       # then draw the Bézier curve passing through these points 
> 
>   class Point:
>    def __init__(self, x, y):
>      (self.x, self.y) = (x, y)
> 
>    def draw(self):
>      # ... code for drawing a dot in the system of coordinates...
> 
>   def __init__(self): # for the zone object
>      self.coord = self.systemOfCoordinates()
>      self.listOfCurves = ( self.Curve() )
> 
>   def expose(self, widget, event):
>      pass
>      # for each curve of self.listOfCurves: draw it


Don't nest classes. Just don't. This might be a valid and good approach
in some programming languages but it's not Pythonic. Your code can
easily be implemented without nested classes.

Christian

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to