You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class instance attributes called __dunder_name are not override'able. For example, you can't do this:
classMyKeyCDNAPI(keycdn.Api):
def__execute(self, *a, **k): # Never gets called!blablabla
As a point, why are any of them private at all? What's the point of hiding things like __api_key? Why not just call it api_key. Then you don't need the setter or the getter. E.g.:
ENDPOINT='https://api.keycdn.com'classApi:
def__init__(self, api_key, endpoint=ENDPOINT):
self.api_key=api_keyself.endpoint=endpoint
...
defget(...):
defpost(...):
defput(...):
defdelete(...):
def_execute(self, call, **params): # the only one that makes sense to make private
...
a=Api(MY_API_KEY)
print(a.endpoint)
print(a.api_key)
a.api_key=MY_OTHER_API_KEY
The text was updated successfully, but these errors were encountered:
Class instance attributes called
__dunder_name
are not override'able. For example, you can't do this:As a point, why are any of them private at all? What's the point of hiding things like
__api_key
? Why not just call itapi_key
. Then you don't need the setter or the getter. E.g.:The text was updated successfully, but these errors were encountered: