benmoran56 / esper

An ECS (Entity Component System) for Python
MIT License
537 stars 67 forks source link

esper.current_world not usable as a module-level property #100

Closed izzyboris closed 1 month ago

izzyboris commented 1 month ago

Describe the bug Unless I'm mistaken, Python doesn't allow module-level @property declarations. It's not possible to use esper.current_world, as it just returns the property object, and a property can't be called either.

To Reproduce Import esper and try to print(esper.current_world):

import esper
print(esper.current_world)
<property object at 0x000002826E75B5B0>
esper.current_world()
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.3\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 1, in <module>
TypeError: 'property' object is not callable

Expected behavior esper.current_world (or esper.current_world() or similar) should print 'default' or whatever name the actual world is set to.

Development environment:

Additional context N/A

benmoran56 commented 1 month ago

Thanks for the bug report. This one slipped through the cracks as I never check it myself. I'll fix this in a point release.

benmoran56 commented 1 month ago

A new point release is out (v3.3) which contains this fix, so closing. Let me know if you see any other issues.