File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,10 +81,16 @@ The ``vec`` class
8181 A generic growable array type. The runtime type parameter ``T `` used when
8282 calling ``vec[T](...) `` determines the element type.
8383
84- The ``capacity `` parameter allows defining the initial
85- minimum capacity of the buffer, some of which may be unused after
84+ The ``capacity `` parameter allows defining the minimum initial
85+ capacity of the buffer, some of which may be unused after
8686 construction. Unused capacity allows fast ``append `` and ``extend ``
87- operations that don't need to reallocate the buffer.
87+ operations that don't need to reallocate the buffer. Actual capacity
88+ will be larger than ``capacity `` if ``items `` has more than ``capacity ``
89+ items.
90+
91+ Mypyc treats ``vec[T]([x] * n) `` as a special form. For example,
92+ ``vec[u8]([0] * n) `` constructs a zero-initialized vec object
93+ efficiently, without building an intermediate list.
8894
8995 It's an error to construct a ``vec `` object without providing an
9096 item type: ``vec() `` raises an exception.
You can’t perform that action at this time.
0 commit comments