On Tue, Dec 10, 2019 at 10:35 AM Piergiorgio Pancino < piergiorgio.panc...@gmail.com> wrote:
> Una alternativa sarebbe impedire l'import star, la domanda infatti verte > su questo: e' possobile sollevare un'eccezione su questo tipo di import? > Definisci __all__ raf@howl € cat lib1.py __all__ = [] def func(): print('lib1') Premi un tasto per continuare... raf@howl € cat lib2.py __all__ = [] def func(): print('lib2') Premi un tasto per continuare... raf@howl € cat main.py from lib1 import * from lib2 import * func() raf@howl € python3 main.py Traceback (most recent call last): File "main.py", line 4, in <module> func() NameError: name 'func' is not defined -- | Raffaele Salmaso | https://salmaso.org | https://bitbucket.org/rsalmaso | https://github.com/rsalmaso
_______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python