Skip to content
masterclass Buddy

Python · Module

__getitem__

operator.getitem(a, b) performs the same lookup as a[b]. It returns the value selected by an index, key, or slice.

Last updated

Syntax

operator.getitem(a, b)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • operator.itemgetter
  • operator.setitem
  • operator.delitem
  • object.__getitem__
  • object.__setitem__
  • object.__delitem__

Source: operator — Standard operators as functions — Python 3.15.2 documentation. Checked 2026-11-03.