Why Python slicing is represented by a colon (:)

Why Python slicing is represented by a colon (:)

Python slicing is expressed using a colon (:). Example:

>>> a=[10,20,30,40,50,60,70,80,90,100,110]
>>> b=a[3:8:2]
>>> print(b)
[40, 60, 80]
>>>

Why use a colon (:)?

⇒ ** If you want to arrange meaningful (role) values, I think it's a colon (:). ** **

The following are similar usages. Excel example

=SUM(D3:D5)

The following is a similar explanation of wikipedia (Japanese) about the colon (:). https://ja.wikipedia.org/wiki/%E3%82%B3%E3%83%AD%E3%83%B3_(%E8%A8%98%E5%8F%B7)

Separate hours, minutes, and seconds of time and time. Its use as a time is specified in ISO 8601. 12:34:54 (12:34:54, 12 hours 34 minutes 54 seconds) 12:34 (12:34, 12 hours 34 minutes, 12 minutes 34 seconds)

Separate chapter numbers and section numbers for books (especially the Bible). For example, "John 1:15" is John 1:15, Gospel of John 1:15.

When expressing an IPv6 address in characters, use a colon to separate each 16 bits. A series of 0s is expressed as "::". For example 2001: db8 :: 1.

Summary

** I think I naturally chose the most appropriate colon (:). ** ** (Python may have some influence on not disliking the colon (:).)

Recommended Posts

Why Python slicing is represented by a colon (:)
Why does Python have to write a colon?
Python list is not a list
What is a python map?
[Python] What is a zip function?
[Python] What is a with statement?
I took a closer look at why Python self is needed
[Python] What is inherited by multiple inheritance?
Why Python is chosen for machine learning
Hash in Perl is a dictionary in Python
What is a dog? Python installation volume
[python] [meta] Is the type of python a type?
Why is 0.1 displayed as 0.1 when printed, even though 0.1 cannot be accurately represented by a floating point number?
A textbook for beginners made by Python beginners
About February 02, 2020 * This is a Python article.
Is sys.settrace, a python genius feature, another language?
Why I'm a Java shop and start Python
A memorandum of extraction by python bs4 request
Launch a shell while a Python script is running
Judge whether it is a prime number [Python]
A memo for creating a python environment by a beginner
Read line by line from a file with Python
Tell me what a conformal map is, Python!
Python is easy
What is python
Python is instance
I thought about why Python self is necessary with the feeling of a Python interpreter
What is Python
Check if the string is a number in python
Python3 datetime is faster just by specifying the timezone
Why not create a stylish table easily with Python?
Basics of Python learning ~ What is a string literal? ~
python> check NoneType or not> if a == None:> if a is None:
How to save a table scraped by python to csv
Group by consecutive elements of a list in Python
[Python] Delete by specifying a tag with Beautiful Soup
Why is the first argument of [Python] Class self?
What is God? Make a simple chatbot with python
[Python] Make sure the received function is a user-defined function
It is blocked by Proxy, a connection error occurs in Python or pip, and it is retried.
Japan Meteorological Agency analysis rainfall (GRIB2 format) is handled by Python as a Numpy array