What is an InstrumentedList in Python?

Question:

During some set operations I encountered this error in Python:

TypeError: unhashable type: 'InstrumentedList'

What is an InstrumentedList in Python? I only found a few references related to SQLAlchemy. Is this a SQLAlchemy implementation of lists or something?

By the way, it happens while doing:

set(self.some_list)

where

print type(self.some_list) # <type 'list'>
Asked By: Aufwind

||

Answers:

Answered By: AJ.

Yes, SQLAlchemy uses it to implement a list-like object which is aware of insertions and deletions of related objects to an object (via one-to-many and many-to-many relationships).

Answered By: Vinay Sajip
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.