mastodon.gamedev.place is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server focused on game development and related topics.

Server stats:

5.5K
active users

#servicetoot

4 posts3 participants0 posts today

#PSA: Die Vorhersagemodelle werden sich zunehmend einig: heute Abend, Mittwoch 12. März ab 20h könnte es das nächste #Binärgewitter live 🔊im #Internet geben - wir freuen uns auf Zuhörer 🎧und Austausch 💬im #Chat web.libera.chat//?channels=#bi oder später in den Kommentaren 🗯️

blog.binaergewitter.de/pages/l #live #podcast #ServiceToot @makefu @madmas @l33tname
#Linux #Technologie #OpenSource

web.libera.chatKiwi IRC

Today I went a bit into the #python #import rabbit hole. Turns out you *can* do cyclic imports (as long as you don't try to access things that have not been created, yet).

Essentially, these are the rules:
* when attempting to load a module, and the module exists in sys.modules, return that module
* otherwise, create a new empty module (without any of the module's content) and insert it into sys.modules
* execute the module's/file's body (which may run other import statements, returning module objects already in sys.modules or inserting new ones)
* when reaching the end of the module/file, take all the defined names and add them to the module as attributes.

(Obviously, this is heavily simplified, there is a ton of other complexity.)

Edit: Forgot to mention:
* before loading the module that you asked to import (using the process described above), Python will load all parent modules (using the same process)