Hi.

If there is possible to connect and login to ftp server within __init__, I 
think it would make sense to add parameter **port** in ftplib.FTP. It could 
look like this:
```
    def __init__(self, host='', port=0, user='', passwd='', acct='',
                 timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *,
                                 encoding='utf-8'):
                self.encoding = encoding
        self.source_address = source_address
        self.timeout = timeout
        if host:
            self.connect(host, port)
            if user:
                self.login(user, passwd, acct)
```
(Or port parameter could be added at the end of the __init__ parameters not to 
break current logic.)

Currently if I need to specify port, I have to do it like this:
```
with FTP() as ftp:
        ftp.connect(host, port)
        ftp.login(user, password)
        # my actions
```

If the port parameter would be added, I could use it like this:
```
with FTP(host, port, user, password) as ftp:
        # my actions
```

In all my cases, all I need is to connect to ftp server and work with it. If 
there is some trouble with connection or login, the code still can't continue 
working with ftp...
Do you rather use connect() and login() explicitly or just let it connect and 
login within __init__ implicitly? What do you think about it?

Thanks.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FIJHPP2OIO7NYJDTGKPPRRTWDQC6IOIO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to