python-nostr icon indicating copy to clipboard operation
python-nostr copied to clipboard

Initializing a dict in an argument.

Open avilior opened this issue 2 years ago • 1 comments

In class Relay init:

class Relay:
    def __init__(
            self, 
            url: str, 
            policy: RelayPolicy, 
            message_pool: MessagePool,
            subscriptions: dict[str, Subscription]={}) -> None:

You are initializing subscriptions to a dict '{}' is this correct?

"the default value for a function argument is only evaluated once, at the time that the function is defined. "

All self.subscriptions will "share" a common dictionary right?

avilior avatar Feb 06 '23 19:02 avilior

ops....This is duplicated of #51

avilior avatar Feb 06 '23 19:02 avilior