Argh!! Can't wrap my head around this Python stuff!

Wanderer wanderer at dialup4less.com
Sun Nov 26 10:21:43 EST 2017


On Sunday, November 26, 2017 at 4:10:12 AM UTC-5, Greg Tibbet wrote:
> I'm an old timer, have programmed in Fortran, C, C++, Perl, and a bit
> of Java and trying to learn this new-fangled Python language!
> 
> I've got a small program that uses PIL to create an image, draw some
> primitives (rectanges, ellipses, etc...) and save it.  Works fine...
> no issues.
> 
> I've found in the past, the best way to "really learn" the language
> was to "dig into the guts" and understand it,.. I thought I was making
> progress, but when looking into the PIL library to see what's going on
> behind the scenes, I find the following code in ImageDraw.py
> 
> def ellipse(self, xy, fill=None, outline=None):
>         """Draw an ellipse."""
>         ink, fill = self._getink(outline, fill)
>         if fill is not None:
>             self.draw.draw_ellipse(xy, fill, 1)
> <...snipped...>
> 
> ellipse() uses the method  self.draw.draw_ellipse()   Okay, fine...
> but WHERE is draw_ellipse defined??  What magic is happening there?
> I've searched the entire PIL directory tree, and the ONLY two places
> draw_ellipse is mentioned are right there in the ellipse() function...
> WHAT am I missing??  
> 
> Thanks!
> -Stumpy (aka Greg)

I'm googlesmart when it comes to Python. I used to know C. I practically knew what the assembly language would look like when it compiled. There was no internet and searching through books can be really laborious so you almost had to really know it to use it. But with Python, I don't start from first principles. I google what I want to do, download the appropriate packages and read through the examples. It can be really frustrating when you get bugs, because you don't know what's going on deep down in the code.



More information about the Python-list mailing list