Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8138563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:31:49+00:00 2026-06-06T11:31:49+00:00

Possible Duplicate: Good Primer for Python Slice Notation reverse a string in Python I’ve

  • 0

Possible Duplicate:
Good Primer for Python Slice Notation
reverse a string in Python

I’ve seen this syntax crop up in a few code snippets I’ve seen lately, and I’m curious as to what it does. If I have my_list = [1,2,3,4,5], and I execute my_list[::-1], I’m given a list with the elements reversed [5,4,3,2,1]. Could someone please explain to me what this actually does, and show the difference between [:] notation and [::]? Or at least refer me to a resource that does.

I’m sure if I had a good Python book it would be in there, but I don’t. And it’s impossible to search Google for something like this since the [::] gets ignored. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:31:51+00:00Added an answer on June 6, 2026 at 11:31 am

    There is no difference between [:] and [::].

    But [::-1] does something else: it has a negative step parameter. The absence of the start and stop parameters means the complete array. The negative step parameter means that data is taken in reverse order, from the end to the start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Good Primer for Python Slice Notation I have a string and I'm
Possible Duplicate: Good Primer for Python Slice Notation I first ran across it last
Possible Duplicate: Good Primer for Python Slice Notation I've been reading over some sample
Possible Duplicate: Is this a good way to generate a string of random characters?
Possible Duplicate: Typedef pointers a good idea? I've seen this oddity in many APIs
Possible Duplicate: How to get line count cheaply in Python? Good day. i have
Possible Duplicate: What’s a good IDE for Python on the Mac? Hi, I'm going
Possible Duplicate: Is there ever a good reason to pass a string to setTimeout?
Possible Duplicate: Calling a function from a string with the function's name in Python
Possible Duplicate: Python-LDAP integration Good afternoon! I am writing a program for work that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.