Manlio Perillo ha scritto: > Andrea Gasparini ha scritto: >> Ciao! >> Qualcuno mi spiega come e' possibile che questo script: >> >> 1 #!/usr/bin/python >> 2 import sys >> 3 import getopt >> 4 >> 5 quiet = False >> 6 >> 7 def main(): >> 8 print quiet >> 9 optlist, args = getopt.getopt(sys.argv[1:], 'q', ['--quiet']) >> 10 >> 11 for o,a in optlist: >> 12 if o in ('-q','--quiet'): >> 13 quiet=True >> 14 > > Hai dimenticato di dichiarare quiet globale. >
Per chi fosse interessato a maggiori dettagli su come funziona il binding di una nome in Python: http://docs.python.org/ref/naming.html > [...] Manlio Perillo _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python