Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•
IT NachrichtenToday’s NYT Mini Crossword Answers for Tuesday, Sept. 29(29.09.2026 um 04:18 Uhr)
••
AI & KI NachrichtenOpenAI axes next model citing safety issues(29.09.2026 um 02:48 Uhr)
•••••
Malware / Trojaner / VirenMalware trends in first half of 2026(25.09.2026 um 13:08 Uhr)
•••
IT NachrichtenToday’s NYT Mini Crossword Answers for Tuesday, Sept. 29(29.09.2026 um 04:18 Uhr)
••
AI & KI NachrichtenOpenAI axes next model citing safety issues(29.09.2026 um 02:48 Uhr)
•••••
Malware / Trojaner / VirenMalware trends in first half of 2026(25.09.2026 um 13:08 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

Why not pprint anymore? Introducing SetPrint: Structural Debugging for Real Data

When your data grows beyond a toy example, pprint starts to break. You see cut-off arrays. Flattened hierarchies. Lost context. And worst of all? Hidden bugs buried under “pretty” formatting. That’s why I created SetPrint — a Python libra…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

When your data grows beyond a toy example, pprint starts to break.


You see cut-off arrays. Flattened hierarchies. Lost context.


And worst of all? Hidden bugs buried under “pretty” formatting.




That’s why I created SetPrint — a Python library that shows structure, not just values.









🔍 What this article covers




  • ✅ Side-by-side comparisons: pprint / setprint

  • ✅ Real-world examples: image data, confusion matrices

  • ✅ Benchmarks + 5 must-know tips for structured debugging









🧪 Quick Colab Demo



Want to see it in action? Try this demo notebook — no install needed.




(To use Colab, a Google account is required.)







🔗 Try this notebook on Google Colab











1. Visual Comparison — pprint vs setprint






data = {
"users": [
{"name": "Alice", "scores": np.array([95, 88, 76])},
{"name": "Bob", "scores": np.array([72, 85, 90])}
],
"meta": {"created": "2025-04-23", "version": 1.2}
}









== pprint ==
{'meta': {'created': '2025-04-23', 'version': 1.2},
'users': [{'name': 'Alice', 'scores': array([95, 88, 76])},
{'name': 'Bob', 'scores': array([72, 85, 90])}]}









== setprint ==
keep_settings
['y', 'y', 'y', 'y']
--------------------------------------------------------

◆dict
├── users:►list
│ ├───── -------. ◆dict
│ │ ├───────── name : Alice
│ │ └───────── scores:>ndarray
│ │ ├─────── 95
│ │ ├─────── 88
│ │ └─────── 76
│ └───── -------. ◆dict
│ ├───────── name : Bob
│ └───────── scores:>ndarray
│ ├─────── 72
│ ├─────── 85
│ └─────── 90
└── meta :◆dict
├───── created:2025-04-23
└───── version: 1.2

--------------------------------------------------------






Even at a glance, the structure is crystal clear.











2. Image Arrays? No Problem






rgb = np.random.randint(0, 255, size=(3, 3, 3))
set_collection ( route='SLIM', y_axis=False, keep_settings={1: 'yf', 2: 'f'} )









keep_settings
['yf', 'f', 'f']
-------------------------------------------------------------------------------------------------

>ndarray
├──── >ndarray [ >ndarray [ 255 0 4 ] >ndarray [ 255 85 0 ] >ndarray [ 255 170 0 ] ]
├──── >ndarray [ >ndarray [ 170 255 0 ] >ndarray [ 85 255 0 ] >ndarray [ 0 255 4 ] ]
└──── >ndarray [ >ndarray [ 0 170 255 ] >ndarray [ 0 85 255 ] >ndarray [ 4 0 255 ] ]

-------------------------------------------------------------------------------------------------






You don’t just see the values—you see the hierarchy.











3. Confusion Matrices as Text-Based Heatmaps






cm = np.array([[50, 2, 0, 0], [3, 45, 1, 0], [0, 4, 60, 5], [0, 0, 6, 70]])
set_collection ( route='SLIM', y_axis=False, keep_settings={1:'y', 2:'x'} )









keep_settings
['y', 'x']
------------------------------

>ndarray
├──── >ndarray ┬──┬──┬──┐
│ 50 2 0 0
├──── >ndarray ┬──┬──┬──┐
│ 3 45 1 0
├──── >ndarray ┬──┬──┬──┐
│ 0 4 60 5
└──── >ndarray ┬──┬──┬──┐
0 0 6 70

------------------------------














4. Benchmark: Visibility vs Speed




























Library Runtime (ms) Structure Clarity
pprint 1.5 ★☆☆☆☆
rich.pretty 3.2 ★★☆☆☆
setprint 4.8 ★★★★★


A few ms extra for full visibility? Totally worth it.











5. 5 Must-Know Tips for Using SetPrint




  1. Use keep_settings = {1: 'x', 3: 'yf', 4: 'f'} for full control over dimensions

  2. Show vertical guides with y_axis=True

  3. Output is a list of lines → easy to write to file

  4. Handles mixed types: dict + list + ndarray? No problem

  5. Switch between styles like 'SLIM', 'BOLD', or even 'HALF'











6. One Function, Infinite Views






from setprint import SetPrint
list_data = SetPrint(data)

formatted = list_data.set_collection(
keep_settings={1:'x', 2:'yf', 3:'f'},
route='SLIM', y_axis=True
)

for line in formatted:
print(line)














🚀 Try it Now






pip install setprint








🎯 If you found it useful, please consider giving a ⭐ on GitHub!

🐛 Bug reports, 💡 feature requests, and 📬 pull requests are all welcome!



📎 GitHub: mtur2007/SetPrint


📘 PyPI: setprint


🔍 Colab Demo: Try on Colab






🔗 Also available on Medium!


💬 I'd love to hear your feedback on either platform. ✨









If you’ve ever said “I just want to see the damn structure” — SetPrint is for you.



(Thank you for reading! This is my very first article introducing SetPrint to the international audience. I'd love to hear your feedback and thoughts.)

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Why not pprint anymore? Introducing SetPrint: Structural Debugging for Real Data

Thematisch verwandte Begriffe: pprint, anymore, Introducing, SetPrint · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-102265 | PyJWT is a Python implementation of JSON Web Token standards. From 2.13…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag