Ciao Gabriele,
le informazioni sono poche per darti un consiglio: tra le varie cose
1-bisogna valutare il rapporto tra il peso computazionale del tuo codice in
relazione al codice della libreria che devi caricare
2- la tipologia di funzioni che devi utilizzare( ricorsive o meno)
3- la quantità di accessi che devi fare alla libreria all'interno del codice

Di base ti consiglio a parità di tali valori di mettere l'import all'inizio
del codice cmq puoi fare sempre delle prove così che ne impari sempre di
più: questo è il mio metodo

Il giorno mar 20 feb 2024 alle ore 14:25 Carlo Miron <mi...@python.it> ha
scritto:

> Ciao Gabriele
>
> Il giorno mar 20 feb 2024 alle ore 13:21 <iz4...@libero.it> ha scritto:
> >
> > Devo usare una libreria abbastanza grossa. Però, non tutto il mio
> programma la usa, ma solo una delle sue funzioni e queesta funzione
> potrebbe essere chiamata una sola volta, più volte o anche non chiamata
> affatto.
> > Secondo voi, l’import di questa libreria è comunque meglio metterlo ad
> inizio programma, o piuttosto all’interno della funzione interessata?
>
> A meno che l'importazione della libreria non impatti percettibilmente
> il tempo di caricamento del programma, ti consiglierei di metterlo
> all'inizio del codice.
> L'import all'interno della funzione in genere è un hack che deve
> essere giustificato (e commentato) a buona ragione.
>
> Buona giornata,
> ㎝
>
> --
> !!!! THE 🍺-WARE LICENSE (Revision ㊷):
>     <miron🐌🐍.🇮🇹> wrote this 📧. As long as you retain this notice you
> can
>     do whatever you want with this stuff. If we meet some day, and you
>     think this stuff is worth it, you can buy me a 🍺 in return. — Carlo
> _______________________________________________
> Python mailing list
> Python@lists.python.it
> https://lists.python.it/mailman/listinfo/python
>


-- 


mobile phone : +39 348 002 8107
tel: +39 0721 1630292
Per appuntamento: https://zcal.co/massimiliano_tornati

TORNATI PROJECT SRL
via Callegari 9-11
61122 Pesaro (PU)
P.IVA/C.F.  02533270415
site: TORNATI PROJECT <http://www.tornatiproject.com>
site:https://itofood.com/

<https://api.whatsapp.com/send/?phone=393496736011&text=%F0%9F%98%8ATornatiProject%C2%A0%20HERE!!!%20how%20can%20help%20you%3F>

<https://api.whatsapp.com/send?phone=393480028107&text=Hello%21+%0A+Can+you+help+me%3F+>

e-mail t...@tornatiproject.com
Whatapp:https://wa.me/message/G6CHK7323ZODI1

The information contained in this e-mail and any attachment is
confidential. It is intended only for the named addressee(s).
If you are not the named addressee(s) please notify us immediately at the
e-mail  t...@tornatiproject.com and then destroy this message.The copy or
distribution of the contents to any other person other than the intended
addressee(s) is strictly prohibited and will be punished according to  the
relevant laws on privacy and Intellectual Property.

Think before you print!
Before you print, please consider if it is necessary. Printing uses
electricity, ink and paper.
_______________________________________________
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python

Rispondere a