I find this a bit confusing:
Should that and
actually be or
?
And what does automatically generated
mean?
I find this a bit confusing:
Should that and
actually be or
?
And what does automatically generated
mean?
To answer that question I suggest you read the source of the ftplib module.
There is a convention that of using a username of anonymous and a made up password that used to be expected to be your email address if I remember right. I think any old string as password would work.
But I do think that the OP is correct, and it should be or
. The parameter has a default of ''
and so ânot givenâ and âempty stringâ should be equivalent.
Due to ambiguities in human language syntax and semantics, both âandâ could be plausibly interpreted to mean the same thing here, i.e. that if the passwd
parameter is any one of ""
, "-"
or not passed, a password is generated. The current âandâ could be validly interpreted to mean âConditions A [not given] and B [empty string or hyphen] both mean a password will be automatically generatedâ, as well as âBoth condition A and condition B are required for a password to be automatically generatedâ. The former is presumably what is intended, but the latter is how you, I and likely most readers would interpret it on first glance.
Using âorâ avoids the ambiguity in this case, so I would indeed suggest going ahead with that change.
As far as I can tell from checking the code, the only âautomatic generationâ I can spot is a snippet to what @barry-scott referred to, automatically sending a password of anonymous@
if the both the username and password are not supplied or "anonymous"
. The code comment is specifically instructive as to why a real email address is not sent in this case:
if user == 'anonymous' and passwd in {'', '-'}:
# If there is no anonymous ftp password specified
# then we'll just use anonymous@
# We don't send any other thing because:
# - We want to remain anonymous
# - We want to stop SPAM
# - We don't want to let ftp sites to discriminate by the user,
# host or country.
passwd = passwd + 'anonymous@'
As a non-FTP expert, thatâs certainly not what I would think when told that a password would be âautomatically generatedâ; Iâm aware of the anonymous
/anonymous
convention for anonymous FTP, but I donât think I would have necessarily made that connection with the description given there. Therefore, it seems useful to modify that explanation accordingly to at least briefly clearly describe what this actually does.
It doesnât mean that both conditions need to be fulfilled for automatic password generation to occur in Albanian and other Indo-European languages. Unlike in English, where âorâ is appropriate, the second âifâ is redundant in this context.
It should be: âIf not given or it isâŚâ