I am describing how this part of my code works:

def store_output(self, file_name, identifier):
    dsc_in = ogr.Open(file_name)
    if dsc_in is None:
        raise Exception("Reading data failed.")
    dsc_out = ogr.Open("PG:" + self.connstr)
    if dsc_out is None:
        raise Exception("Database connection has not been established.")
    layer = dsc_out.CopyLayer(dsc_in.GetLayer(), identifier,
    if layer is None:
        raise Exception("Writing output data to the database failed.")

I now want to describe the "if layer is None:" parts, and I am missing a word (or a couple of words):

"Each of the three above mentioned operations is followed by a simple ______________ that checks if the output of the operation is not None."

I thought about "statement", but I feel like that's not exactly what it is.

  • 5
    I would probably say "exception handler," but I feel like this is more of a technical question than an English one. – J.R. Dec 29 '17 at 16:19
  • You have to assess your audience/context and decide whether a technical term or an informality such as "bit of code" is appropriate. You could say, for example, "conditional test that raises an exception when applicable" – Tᴚoɯɐuo Dec 29 '17 at 16:48
  • 1
    In plain English, the "if layer is None" line is a test. You're looking at a simple test that checks whether the output of .CopyLayer is None. – Gary Botnovcan Dec 29 '17 at 16:49
  • I would never use "bit" in its informal sense to describe computer code because there is a quite different technical sense used in computer science. I like the "simple test" suggested in the last comment. Alternatively, "short procedure" works. – Jeff Morrow Dec 29 '17 at 16:56
  • 1
    Or, shorter, "... followed by a simple test if the output ..." – Mr Lister Dec 29 '17 at 17:33
// --------------------------
    dsc_in = ogr.Open(...)    // A statement that evaluates an expression (the method) and then assigns its result to a variable.
    if dsc_in is None:        // A conditional statement that evaluates an expression.
        raise Exception()     // A statement.
// --------------------------
    dsc_out = ogr.Open(...)   // Same pattern as above...
    if dsc_out is None:
        raise Exception()
// --------------------------
    layer = dsc_out.Copy(...) // Same pattern as above...
    if layer is None:
        raise Exception()

Each of the three abovementioned operations is followed by a simple _____ that checks if the output of the operation is different from None."

Some general terms:

  • Statement - Basically any "line" of code. Line is in quotes because you can technically have a statement span multiple lines.
  • Expression - Something that is evaluated to produce a value. This could be a method call, such as in the above code snippet, or even something like "1 + 1".
  • Operation - A mathematical or binary action. (+, -, *, /, |, &, etc)

If I could suggest a description of this code snippet, I would say:

Each of the three aforementioned assignment statements is followed by a test to see whether the assigned value is "none", and if so, an exception is raised.


I would say something like code block, piece of code, or a more specific description of the statement(s). That is, since "if layer is None" is an if statement, I might say "followed by a simple if statement..." with the implied context that I am referring to the entirety of the conditional and the code within it.

  • 1
    Agreed. It's an "if statement", common programming jargon. – Andrew Dec 29 '17 at 16:53
  • Yes, I'd say code block, block of code, or just block. It's a lot easier discover the usual term if you work with a language that uses something like {} to delimit blocks of code :-) – jamesqf Dec 30 '17 at 5:43

The part that "checks" is called a (boolean) condition:

In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. - wikipedia (emphasis, mine)

  • Technically true, but I think the OP is asking for a term to describe the block of code that's executed if the result of logical if statement is true. – jamesqf Dec 30 '17 at 5:41
  • Technically, the condition is (blah) is None, and the whole if-then-else chunk is the conditional statement (or just conditional for short). – Hellion Dec 30 '17 at 6:03
  • @jamesqf Actually, the OP was interested in "a simple ___ that checks if the output ... is different from None" (emphasis, mine). The part that gets executed if the statement is true isn't the check itself. – Lawrence Dec 30 '17 at 6:05

Consider also guard, a word for a conditional that emphasizes that some code must be prevented from executing if a condition is not met.


I, as someone who's a native English speaker and has been programming professionally for decades, would say... "bit of code" to fill the blank in "Each of the three above mentioned operations is followed by a simple ______________ that checks if the output of the operation is different from None."

  • Please read the body of the question and not just the title. – The Great Duck Dec 30 '17 at 8:00
  • @Typhon the phrase "bit of code" is what I'd use to fill in the blank. – RonJohn Dec 30 '17 at 14:39
  • alright fair enough, but they are asking for the formal technical term and not just any way to refer to it with English. – The Great Duck Dec 30 '17 at 21:07
  • @Typhon I don't see any reference in the Q to a request for a technical term. – RonJohn Dec 30 '17 at 21:41
  • "I feel like that's not exactly what it is." (emphasis mine). Clearly a bit of code is considered not specific enough for them, hence they are looking for the technical term. Furthermore they used the tag terminology meaning that they want a technical term. – The Great Duck Dec 30 '17 at 23:18

Unfortunately you are overthinking it and should rely on the laziness of programmers:

Each of the three above mentioned operations is followed by a simple check that the output of the operation is not None.

For the code you posted, this is a very clear description.

In general when you “snip” out a piece of code to look at or use you can call it a “snippet”


a short piece of code, as given in this book on programming: short piece of code

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.