Eric V. Smith <e...@trueblade.com> added the comment:

I was thinking about something like:

@dataclass
class FtpHelper(ftplib.FTP):
    my_host: str
    my_user: str
    lookup_password: InitVar[Callable]

    def __post_init__(self, lookup_password):
        super().__init__(host=self.my_host, user=self.my_user, 
passwd=lookup_password())

def get_password():
    return "a password"

ftp = FtpHelper(hostname, username, get_password)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44365>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to