Python – Paolo Redaelli https://monodes.com/predaelli A civil engineer with a longlife fondness for Software Libero Sat, 15 Mar 2025 07:16:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 91795679 Codon: high-performance Python compiler https://monodes.com/predaelli/2025/03/15/codon-high-performance-python-compiler/ https://monodes.com/predaelli/2025/03/15/codon-high-performance-python-compiler/#respond Sat, 15 Mar 2025 07:16:23 +0000 https://monodes.com/predaelli/?p=12976

Codon: high-performance Python compiler

Codon is a high-performance Python implementation that compiles to native machine code without any runtime overhead. Typical speedups over vanilla Python are on the order of 10-100x or more, on a single thread. Codon’s performance is typically on par with (and sometimes better than) that of C/C++. Unlike Python, Codon supports native multithreading, which can lead to speedups many times higher still.

Think of Codon as Python reimagined for static, ahead-of-time compilation, built from the ground up with best possible performance in mind.

]]>
https://monodes.com/predaelli/2025/03/15/codon-high-performance-python-compiler/feed/ 0 12976
How to connect Python to WordPress https://monodes.com/predaelli/2025/02/21/how-to-connect-python-to-wordpress-2/ https://monodes.com/predaelli/2025/02/21/how-to-connect-python-to-wordpress-2/#respond Fri, 21 Feb 2025 16:33:00 +0000 https://monodes.com/predaelli/?p=12812

How to connect Python to WordPress – Call Me Fred

]]>
https://monodes.com/predaelli/2025/02/21/how-to-connect-python-to-wordpress-2/feed/ 0 12812
pyper – Concurrent Python made simple https://monodes.com/predaelli/2025/01/15/pyper-concurrent-python-made-simple/ https://monodes.com/predaelli/2025/01/15/pyper-concurrent-python-made-simple/#respond Wed, 15 Jan 2025 22:51:17 +0000 https://monodes.com/predaelli/?p=12270 https://github.com/pyper-dev/pyper

]]>
https://monodes.com/predaelli/2025/01/15/pyper-concurrent-python-made-simple/feed/ 0 12270
Python Shared Memory in Multiprocessing https://monodes.com/predaelli/2024/08/28/python-shared-memory-in-multiprocessing/ https://monodes.com/predaelli/2024/08/28/python-shared-memory-in-multiprocessing/#respond Wed, 28 Aug 2024 12:55:54 +0000 https://monodes.com/predaelli/?p=11883 Python Shared Memory in Multiprocessing

np_array's size=220.0MB
With SharedMemory: ...
Current memory usage 0.11283MB; Peak: 0.156706MB
Time elapsed: 0.99s
No SharedMemory: ...
Current memory usage 0.026587MB; Peak: 467.558995MB
Time elapsed: 5.48s

I think I shall go for shared memory! My Amiga formation years requires it!

]]>
https://monodes.com/predaelli/2024/08/28/python-shared-memory-in-multiprocessing/feed/ 0 11883
Huge chances? https://monodes.com/predaelli/2024/08/13/huge-chances/ https://monodes.com/predaelli/2024/08/13/huge-chances/#respond Tue, 13 Aug 2024 19:04:00 +0000 https://monodes.com/predaelli/?p=11857 I know I know the Observer Pattern. I just wanted to be sure what was the best practice in Python. I found this:

Risky Implementations: If the pattern is not implemented carefully, there are huge chances that you will end up with large complexity code.

From https://www.geeksforgeeks.org/observer-method-python-design-patterns/

With all the complex code out there having “risky implementations” the observer pattern is one of the mildest.

]]>
https://monodes.com/predaelli/2024/08/13/huge-chances/feed/ 0 11857
Did You Know — Adding = After an Expression in a Python f-string https://monodes.com/predaelli/2024/02/25/did-you-know-adding-after-an-expression-in-a-python-f-string/ https://monodes.com/predaelli/2024/02/25/did-you-know-adding-after-an-expression-in-a-python-f-string/#respond Sun, 25 Feb 2024 17:19:15 +0000 https://monodes.com/predaelli/?p=11370 Did You Know — Adding = After an Expression in a Python f-string | by Liu Zuo Lin

 

# eg. f’{x=}’ returns ‘x=’

n = 5
print(f'{n+1=}')    # n+1=6
n = 5
print(f'{n+10=}')    # n+10=15
]]>
https://monodes.com/predaelli/2024/02/25/did-you-know-adding-after-an-expression-in-a-python-f-string/feed/ 0 11370
Textual https://monodes.com/predaelli/2023/12/17/textual/ https://monodes.com/predaelli/2023/12/17/textual/#respond Sun, 17 Dec 2023 11:26:08 +0000 https://monodes.com/predaelli/?p=11033

Textual is a TUI framework for Python, inspired by modern web development.

Textual is a Rapid Application Development framework for Python, built by Textualize.io.

Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal or a web browser!

Well, I just wish I could have it in EIffel….

]]>
https://monodes.com/predaelli/2023/12/17/textual/feed/ 0 11033
Using CSV File as data storage and access https://monodes.com/predaelli/2023/09/01/using-csv-file-as-data-storage-and-access/ https://monodes.com/predaelli/2023/09/01/using-csv-file-as-data-storage-and-access/#respond Fri, 01 Sep 2023 16:50:00 +0000 https://monodes.com/predaelli/?p=10758 Thanks adamchainz!

You can use “CSV” table storage in (at least) these database backends:

However these will be slow though. Changes to CSV based tables require a lot of parsing and re-saving.

It’s probably better to import the CSV into a table with an optimized storage engine, and export it again later. django-import-export can help with that: https://pypi.org/project/django-import-export/

Source: Using CSV File as data storage and access
]]>
https://monodes.com/predaelli/2023/09/01/using-csv-file-as-data-storage-and-access/feed/ 0 10758
Noob or “just” oldish? https://monodes.com/predaelli/2023/08/13/noob-or-just-oldish/ https://monodes.com/predaelli/2023/08/13/noob-or-just-oldish/#respond Sun, 13 Aug 2023 08:35:47 +0000 https://monodes.com/predaelli/?p=10691 Young Jedi Anmol Tomar, your pythoninc knowledge lacks historical viewpoint. List Comprehensions were the Python Enhancement Proposals( PEP) 202.

In fact Anmol Tomar wrote on medium.com “9 Python Mistakes That Reveal You’re a Nooby! Move away from noob status!”. Too bad he want to be read only by people in medium walled garden. The fist is readable:

1. Neglecting Pythonic Idioms

Python has its own set of idioms and best practices that make your code more elegant and readable. A common mistake among newcomers is writing code in a non-Pythonic way.

For example, using excessive loops when list comprehensions or generator expressions could provide a more concise solution. Embrace Pythonic idioms to improve the readability and maintainability of your code.

Wrong

# Non-Pythonic way
squared_numbers = []
for i in range(1, 6):
squared_numbers.append(i ** 2)

In this example, using a list comprehension provides a more concise and readable solution compared to the traditional loop and append approach.

Correct

# Pythonic way
squared_numbers = [i ** 2 for i in range(1, 6)]

Young Jedi, your pythoninc knowledge lacks historical viewpoint. The “non python way” was the only pythonic way back in the 1.5.x days.

]]>
https://monodes.com/predaelli/2023/08/13/noob-or-just-oldish/feed/ 0 10691
Django-LiveView https://monodes.com/predaelli/2023/07/23/10654/ https://monodes.com/predaelli/2023/07/23/10654/#respond Sun, 23 Jul 2023 09:57:42 +0000 https://monodes.com/predaelli/?p=10654 Django LiveView: Framework for creating Realtime SPAs using HTML over the Wire technology django-liveview-demo.andros.dev/

]]>
https://monodes.com/predaelli/2023/07/23/10654/feed/ 0 10654