←back to thread

310 points brylie | 1 comments | | HN request time: 0.211s | source
Show context
askonomm ◴[] No.43516546[source]
First thing that I don't like is the settings being strings that reference classes. Usually that means that go-to definition does not work (I've seen similar things in Symfony with YAML use). If the config needs to reference a class, or some object, I would like to be able to easily navigate to it as opposed to having to manually search the project for it. If this was an actual object reference as opposed to a string, I could, and I'd also get intellisense for if I typed it right or not, and autocomplete.

Then of course they "solve" it later with a (probably paid) plugin. But why? LSP's support this natively, and for free, just don't use strings.

replies(2): >>43516947 #>>43517164 #
beaugunderson ◴[] No.43516947[source]
> First thing that I don't like is the settings being strings that reference classes.

Those classes can reference the settings, so including them as strings is done to allow that to work without creating circular imports.

replies(1): >>43517274 #
askonomm ◴[] No.43517274[source]
Ah yeah, didn't remember that constraint in Python. I thought I read something about a future version fixing that when it comes to just type hints, but I suppose that wouldn't work here, since it's not really a type hint, right?
replies(1): >>43518479 #
1. beaugunderson ◴[] No.43518479[source]
Yup, you're thinking of "postponed evaluation of annotations", which is currently optional with `from __future__ import annotations`. But as you said, would not fix the circular import here.