Re: [Python] Domanda su import.

2024-02-21 Per discussione Massimiliano Tornati
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  ha
scritto:

> Ciao Gabriele
>
> Il giorno mar 20 feb 2024 alle ore 13:21  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 ㊷):
>  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 
site:https://itofood.com/





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


Re: [Python] modo furbo per trovare pattern differenti in una stringa

2024-02-14 Per discussione Massimiliano Tornati
Ciao,
visto che il GCode è un codice strutturato in cui se trovi dei comandi
specifici hai delle funzioni apposite; puoi definire una classe con gli
oggetti che la compongono così che poi ti puoi gestire tutto il codice
strutturato secondo le varie funzioni che ti servono perchè in realtà nono
sono a caso.

Il giorno mar 13 feb 2024 alle ore 14:32 Perini Matteo <
perini.mat...@gmail.com> ha scritto:

> Ciao a tutti,
>
> è da un po' che non scrivo.
>
> Vi chiedo aiuto perchè sto cercando di leggere delle coordinate da un file 
> Gcode.
>
> Un esempio del testo da parsare è:
>
> ;LAYER:1
> ;MESH:untitled.stl
> G0 F7200 X1298 Y1798 Z4
> ;TYPE:WALL-OUTER
> G1 F1800 X702 Y1798 E1494.81223
> G1 X702 Y1202 E2242.21834
> G92 E0
> G1 X1298 Y1202 E747.40611
> G1 Y1798 X1298 E1494.81223
> ;TIME_ELAPSED:177.752007
> ;CHANGE;
> ;LAYER:2
> ;MESH:untitled.stl
> G0 F7200 X1298 Y1798 Z6
> ;TYPE:WALL-OUTER
> G1 F1800 X702 Y1798 E2242.21834
> G92 E0
> G1 X702 Y1202 E747.40611
>
> non ho grossi problemi ad effettuare un parsing corretto ma lo sto facendo 
> con vari if, elif, case,  ecc. cosa che non mi piace molto.
>
> Stavo provando ad utilizzare le regex ma non sto riuscendo a fare quello che 
> voglio (in modo pulito) ovvero identificare le coordinate X, Y e Z anche se 
> in alcuni casi hanno posizioni invertite.
> Vorrei anche attribuire un nome al gruppo identificato in modo da usarlo come 
> dizionario.
> Stavo usando alcuni pattern tipo ".*Z(?P\d+[.]?\d*)" che vanno bene per 
> individuare le coordinate di un asse ma capita che le righe contengano x y e 
> z oppure solo Z oppure solo x e y.
> Importante, in alcuni casi potrebbero essere anche in ordine differente tipo 
> z y e x.
>
> Per ora i numeri dopo E e F posso trascurarli ma vi chiederei aiuto per 
> riuscire ad ottenere le coordinate da ogni riga.
>
> se tutte le righe rispettassero lo stesso pattern non avrei problemi ma non 
> so come affrontare soprattutto il problema di avere pattern diversi in ordine 
> (quasi) random.
>
> Spero di essere stato abbastanza chiaro.
>
> Grazie a tutti
>
> Matteo
>
>
>
>
> ___
> 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 
site:https://itofood.com/





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


Re: [Python] Mail o WA con python?

2023-09-19 Per discussione Massimiliano Tornati
Ciao
io ho usato pywhatkit seguendo il tutorial del link:
Automate WhatsApp Messages With Python using Pywhatkit module -
GeeksforGeeks

a me ha funzionato abbastanza bene.

A presto

Il giorno lun 18 set 2023 alle ore 23:07 Giuliano Curti <
giulian...@gmail.com> ha scritto:

> Ciao a tutti,
> ho una domanda borderline; ho guardato l'archivio fino a dicembre 2019, ma
> non ho riscontrato altri post sul tema e quindi provo.
>
> Sto costruendo una piccola procedura di controllo di una situazione
> remota; vorrei corredarla di una funzione di segnalazione in caso di
> allerta; da qui la prima domanda: mi consigliate l'uso di mail o di msg WA?
>
> Nel primo caso userei la libreria smtplib di cui ho visto in rete diversi
> articoli;
> nel caso la scelta cadesse verso WA mi piacerebbe sapere quale libreria
> adottare fra le diverse (pywhatkit, whatdesk, franz, ecc.) che ho
> incrociato.
>
> Grazie, saluti,
> Giuliano
>
> ___
> 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 
site:https://itofood.com/





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