0

I am adding some comments on this line of code.

# param winname cannot be null, neither can be empty string ''
imshow(winname, mat) -> None

in this case, is it clear, grammatical and idiomatic to use "neither can be"?

  • 1
    No - cannot be null or an empty string is what I'd put. If you wanted to use neither in that position you'd have to say something like cannot be null; neither can it be an empty string - but this is not a suitable style for a comment in some code. – user96060 Jun 9 '19 at 11:25
  • 1
    The answers suggest good corrections so I won’t add another one, but in that comment you’re confusing neither and nor - nor is like or for a list of negative things (a list of things that are excluded): – Mixolydian Jun 9 '19 at 12:51
  • No - neither also has that function. Nor would be a more likely choice, for sure, but the Q is about neither. – user96060 Jun 9 '19 at 16:11
2

This use is not clear. You have a few options:

  • param winname cannot be null nor can it be an empty string.
  • param winname can be neither null nor an empty string.
  • If possible (and I don't know if it is) I'd make this into a positive statement (something like param winname must be a XXX, but I don't know what XXX would be).

Although this is a comment, it also looks a bit like an error message. If so, I'd make it into two error messages, one for each case.

  • param winname cannot be null
  • param winname cannot be an empty string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy