Skip to main content
deleted 24 characters in body
Source Link
Janne Karila
  • 10.7k
  • 21
  • 34
  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can avoideliminate all the float calls by putting this at the top, or bybecause you are using Python 3: where true division is the default.

      from __future__ import division
    
  • for loops are generally preferred over while loops. A possible way to arrange the inner loop is this:

      z = 0
      for iteration in range(MAX_COUNT):
          z = z**2 + c
          if abs(z) >= 2:
              fill = (255 - iteration, 255 - iteration, 255 - iteration)
              break
      else:
          fill="black"
      draw.point((col, row), fill=fill)
    
  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can avoid all the float calls by putting this at the top, or by using Python 3:

      from __future__ import division
    
  • for loops are generally preferred over while loops. A possible way to arrange the inner loop is this:

      z = 0
      for iteration in range(MAX_COUNT):
          z = z**2 + c
          if abs(z) >= 2:
              fill = (255 - iteration, 255 - iteration, 255 - iteration)
              break
      else:
          fill="black"
      draw.point((col, row), fill=fill)
    
  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can eliminate all the float calls because you are using Python 3 where true division is the default.

  • for loops are generally preferred over while loops. A possible way to arrange the inner loop is this:

      z = 0
      for iteration in range(MAX_COUNT):
          z = z**2 + c
          if abs(z) >= 2:
              fill = (255 - iteration, 255 - iteration, 255 - iteration)
              break
      else:
          fill="black"
      draw.point((col, row), fill=fill)
    
added 406 characters in body
Source Link
Janne Karila
  • 10.7k
  • 21
  • 34
  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can avoid all the float calls by putting this at the top, or by using Python 3:

      from __future__ import division
    
  • for loops are generally preferred over while loops. A possible way to arrange the inner loop is this:

      z = 0
      for iteration in range(MAX_COUNT):
          z = z**2 + c
          if abs(z) >= 2:
              fill = (255 - iteration, 255 - iteration, 255 - iteration)
              break
      else:
          fill="black"
      draw.point((col, row), fill=fill)
    
  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can avoid all the float calls by putting this at the top, or by using Python 3:

      from __future__ import division
    
  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can avoid all the float calls by putting this at the top, or by using Python 3:

      from __future__ import division
    
  • for loops are generally preferred over while loops. A possible way to arrange the inner loop is this:

      z = 0
      for iteration in range(MAX_COUNT):
          z = z**2 + c
          if abs(z) >= 2:
              fill = (255 - iteration, 255 - iteration, 255 - iteration)
              break
      else:
          fill="black"
      draw.point((col, row), fill=fill)
    
Source Link
Janne Karila
  • 10.7k
  • 21
  • 34

  • This feels a bit backwards to me

      img = Image.new("RGB", (2400, 2400), "white")
      width = img.size[0]
      height = img.size[1]
    

    compared to this

      WIDTH = 2400
      HEIGHT = 2400
      img = Image.new("RGB", (WIDTH, HEIGHT), "white")
    
  • You can avoid all the float calls by putting this at the top, or by using Python 3:

      from __future__ import division