In "Automate the boring stuff", there is a strange part that I can not find the answer anywhere either in the book or on the internet, it 's --snip-- (line 23) the following code is cited from the book:

here is a picture of my code, --snip-- is at line 23

It is not a complete code but could you please explain for me what --snip-- (line 23) does here?

1 Answers

3
Patrick Artner On

Most probably it is used as I removed some code that is not important - like the sound a scissor makes if you --snip-- something from some other thing.

Example usage:

for i in range(200):
    print(i)

Output:

1
2
--snipp--
199
200

It is similar to plonk - the sound something makes if you put it into the trashbin.

From wikipedia:

  • Onomatopœia:

    is the process of creating a word that phonetically imitates, resembles, or suggests the sound that it describes. As such words are uncountable nouns, onomatopoeia refers to the property of such words. Common occurrences of words of the onomatopoeia process include animal noises such as "oink", "miaow" (or "meow"), "roar" and "chirp". Onomatopoeia can differ between languages: [...] hence the sound of a clock may be expressed as tick tock in English, tictac in Spanish, dī dā in Mandarin, katchin katchin in Japanese, or tik-tik in Hindi.