Collection#
Iterate handles, look up stable IDs first, then exact unambiguous names. No integer indexing.
DataCollection, Uses, SceneCollections and Components support this lookup protocol:
| Expression | Result |
|---|---|
collection[key] | Handle matched by exact ID first, then exact name |
collection.get(key, default=None) | Matching handle; default only when absent |
for item in collection | Iterate current handles |
len(collection) | Current item count |
Missing subscription raises KeyError; ambiguous names raise plupy.AmbiguousError even with .get(). Integer indexing is not supported. Datablocks iterate by ID; scene uses iterate in hierarchy order. A collection view is live, not a stored copy.
class CollectionUsage and examples
Derived types: Components · DataCollection · SceneCollections · Uses
Members: Iteration · Length · Indexing · get
Iteration#
for item in xIterate the current handles (a live view, not a stored copy).
Length#
len(x)The current item count.
Indexing#
x[key]The handle whose ID equals key, else the one whose name equals it exactly. KeyError when none matches (the message lists what exists), AmbiguousError when several share the name. No integer indexing.
get#
get(key, default=None)self[key], or default when absent; an ambiguous name still raises AmbiguousError.
Related types#
AmbiguousError · Components · DataCollection · Handle · SceneCollections · Uses
Source#
- _live.py:149