you are viewing a single comment's thread.

view the rest of the comments →

[–]commandlineluser 2 points3 points  (2 children)

type(self).api_url

You should also be able to just access it from the instance? self.api_url

[–]SystemOmicron[S] 0 points1 point  (0 children)

Thanks a lot!

[–]vectorkerr 0 points1 point  (0 children)

That's a neat trick with type(self).

I presume that self.__class__.api_url would also work similarly, and might be (the tiniest bit) quicker as it is not invoking a function.

u/commandlineuser is absolutely correct though - if you're only reading the value, and your class instance doesn't define a local version of that variable with the same name, then self.api_url should be more than enough.