Python: Objects that change (for story reasons)
For my visual novel project, I wanted things that have images and tags, but can mutate or change as they gain more.
This is the code I wrote: (Fediverse readers might find it looks nicer on the original page)
class item: def __init__(self, name): self.name = name self.tags = ['exists','unchanged'] def setImage(self,image): self.image = image def aquire(self, tag): self.tags.append(tag) # look changerer list and trigger if needed for changer in self.changers: if changer[0]==tag: dothis = changer[1] for adding in dothis.add_tags: self.tags.append(adding) for taking in dothis.remove_tags: self.tags.remove(taking) if self.name != '': self.name = dothis.name if self.image != '': self.image = dothis.image #endif #endfor def change_on_aquire(self, trigger_tag, changer): tup_store = (trigger_tag,changer) self.changers.append(tup_store) class changer: def __init__(self, name, image): self.name = name self.image = image self.add_tags = ['changed'] self.remove_tags = ['unchanged'] def addTag(self, tag): self.add_tags.append(tag) def removeTag(self, tag): self.remove_tags.append(tag)
I’m far from a seasoned Python game dev, which is why I am open to some feedback. Please feel free to review my code, tell me what I did wrong, and educate me on better ways to do it.
You can use this code yourself if you leave a comment saying where you got it, and don’t blame me if it doesn’t work. This is a work in progress.
What it does (or should do)
The first class is a thing that takes an image, a name, and some tags. It can receive new tags via the acquire method, where it checks for changers and applies them.
Changers – the second class – takes a name, an image, and two sets of tags (to remove and to add).
For example, we have a sword item with the “sharp” and “normal” tags. It acquires the “magic” tag. Following the changer, it renames to “enchanted sword”, drops the “normal” tag and gains the “magic” and “upgraded” tags. The picture changes from a boring sword to a nice glowing sword.
Items and their changers will be defined in the code – probably in a file called alltheitems.py. This way, I can change the defined values and triggers as needed.
I usually have to look up how Python handles arrays, as it has a bunch of ways of doing that. I think I have chosen wisely, but feel free to tell me how I have been a Class II Silly Billy.
Syndicated to:#codeReview #endfor #endif #Python #visualNovel
Today's stupid #python mistake
```
var = var = fallback
```
instead of
```
var = var or fallback
```
L'asso Éthiciel poursuit son chemin.
5 hackathons du Libre depuis le début de l'année avec un projet qui prend de l'ampleur et qui se révèle vraiment passionnant et mobilisant des bénévoles motivé-e-s et motivant-e-s !
Je remercie jeveuxaider qui nous donne la visibilité nécessaire pour le recrutement de nos bénévoles.
Bravo pour cette initiative !
#ethiciel #hackathondulibre #benevolat #dev #devops #python #rust #typescript #zola #js #html #jeveuxaider
contact@ethiciel.org
and with that... I'm actively looking for my next contract, ideally something around ~20h/week. deep knowledge of #Python/#Django, long time #NodeJS Dev, talk to me about #WebComponents!
Minimizar al tray un programa hecho en PyQt5 https://myblog.clonbg.es/minimizar-al-tray-un-programa-hecho-en-pyqt5/ #Programación #PyQT #Python https://clonbg.es

O, fajna. Wygląda na to, że do wsparcia Pythona 3.14 w #Django w #Gentoo brakowało tylko jednej łatki. I działa!
Oh nice, I see that #Django 5.2.7 was missing only one patch for #Python 3.14 support in #Gentoo. Now in!
The Python Papers newsletter now has over 9500 subscribers! Join us today and push it over the top to 10k!
I write about everything #Python there, including:
🐍 Python basics
🐍 Python and Evcel
🐍 Creating TUIs with Python
🐍 PDFs and Python
🐍 Python tooling
🐍 and much much more!
ah. #powertoys can only remap "Copilot" key, but not Shift+Copilot" or "Altgr+Copilot >_<"
but you can remap keyboard with #python !? https://github.com/ModEraNoah/F23-Key-To-Ctrl/blob/main/main.py
Two ways to write code:
1️⃣ Imperative Approach: A clear, step-by-step.
2️⃣ Functional Approach: A concise, chained expression.
Which style do you prefer, and why? 👇
#Python #Pandas #DataScience #Coding #ProgrammingStyles

AP 2.0: Учим ИИ думать, прежде чем патчить
Привет, Хабр! Не так давно я рассказывал вам о рождении формата .ap (AI-friendly Patch) — моей попытке избавить мир от боли ручного копипаста при работе с AI-ассистентами. Идея была проста: вместо генерации блоков кода, который нужно переносить в исходники руками, ИИ генерирует семантический патч в специальном, удобном именно для ИИ формате, который применяется автоматически. Судя по числу добавлений статьи в закладки, идея многим пришлась по душе! Но теория — это одно, а суровая практика — совсем другое. За время активного использования ap в реальных задачах (в том числе при работе над far2l ) вскрылись узкие места и накопились идеи, как сделать формат ещё надёжнее, удобнее и, что самое главное, — ещё более «понятным» для нейросетей. Сегодня я хочу рассказать вам о результате этой работы — большом обновлении ap 2.0 Это не просто косметические правки, а серьезный шаг вперёд, основанный на главном инсайте: лучшие результаты ИИ показывает тогда, когда мы позволяем ему сначала спланировать свои действия на человеческом языке, и только потом — реализовать их в виде кода. Поехали!
https://habr.com/ru/articles/957716/
#ap #ИИ #AI #патч #python #yaml
#Python Friday #301: Introducing #LangChain for #AI Applications
https://pythonfriday.dev/2025/10/301-introducing-langchain-for-ai-applications/