Qualche altra modifica. Mi sa che per essere python puro
Leonardo Robol [2010-02-23 11:04]
Qualche altra modifica. Mi sa che per essere python puro
di più non si può pretendere.
diff --git a/NewtonFractal.py b/NewtonFractal.py
old mode 100644
new mode 100755
index 5cbe466..2e124d0
--- a/NewtonFractal.py
+++ b/NewtonFractal.py
@@ -1,4 +1,4 @@
-#!/usr/bin/enb python
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Sample script to generate a PNM image
@@ -50,8 +50,8 @@ def Newton(size = 200):
delta = 4 / float(size - 1)
# Creiamo gli indici su cui iterare
- x_values = xrange(0 , size)
- y_values = x_values
+ x_range = xrange(0 , size)
+ y_range = x_range
# Apriamo il file dove salveremo il nostro lavoro
@@ -62,8 +62,8 @@ def Newton(size = 200):
f.write("255\n")
# Scriviamo la matrice su file
- for x in x_values:
- for y in y_values:
+ for x in x_range:
+ for y in y_range:
value = GetNewtonConvergenceSpeed(complex(-2 + x * delta,
-2 + y * delta))
f.write( str(3 * value) + " " +
@@ -74,4 +74,4 @@ def Newton(size = 200):
if __name__ == "__main__":
- Newton (500)
+ Newton (1024)