2👍
From the Python docs:
list.pop([i])
Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list.
Like Rohan says, use get()
:
context['payment_data'] = self.request.session.get('payment_data', False)
context['feature_data'] = self.request.session.get('feature_data', False)
Source:stackexchange.com