Dario Bertini wrote: > visto che nessuno l'ha ancora menzionato, ci tengo comunque > a ricordare che gli __init__.py sono necessari solo se volete > essere compatibili con vecchie versioni di Python > > con la pep 0420 infatti sono stati aggiunti i namespace modules > > http://www.python.org/dev/peps/pep-0420/
Non è esatto. La definizione dei package tramite la presenza di un file __init__.py non è deprecata, non verrà rimossa, e rimane il meccanismo statico di base. Dalla PEP citata: "There is no intention to remove support of regular packages. If a developer knows that her package will never be a portion of a namespace package, then there is a performance advantage to it being a regular package (with an __init__.py). Creation and loading of a regular package can take place immediately when it is located along the path. With namespace packages, all entries in the path must be scanned before the package is created." <http://www.python.org/dev/peps/pep-0420/#discussion> -- Nicola Larosa - http://www.tekNico.net/ In the years after 9/11, so many people chose to drive instead of fly that the resulting deaths dwarfed the deaths from the terrorist attack itself, because cars are much more dangerous than airplanes. - Bruce Schneier, September 2013 _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python