+ """``SEQUENCE`` structure type
+
+ You have to make specification of sequence::
+
+ class Extension(Sequence):
+ __slots__ = ()
+ schema = (
+ ("extnID", ObjectIdentifier()),
+ ("critical", Boolean(default=False)),
+ ("extnValue", OctetString()),
+ )
+
+ Then, you can work with it as with dictionary.
+
+ >>> ext = Extension()
+ >>> Extension().specs
+ OrderedDict([
+ ('extnID', OBJECT IDENTIFIER),
+ ('critical', BOOLEAN False OPTIONAL DEFAULT),
+ ('extnValue', OCTET STRING),
+ ])
+ >>> ext["extnID"] = "1.2.3"
+ Traceback (most recent call last):
+ pyderasn.InvalidValueType: invalid value type, expected: <class 'pyderasn.ObjectIdentifier'>
+ >>> ext["extnID"] = ObjectIdentifier("1.2.3")
+
+ You can know if sequence is ready to be encoded:
+
+ >>> ext.ready
+ False
+ >>> ext.encode()
+ Traceback (most recent call last):
+ pyderasn.ObjNotReady: object is not ready: extnValue
+ >>> ext["extnValue"] = OctetString(b"foobar")
+ >>> ext.ready
+ True
+
+ Value you want to assign, must have the same **type** as in
+ corresponding specification, but it can have different tags,
+ optional/default attributes -- they will be taken from specification
+ automatically::
+
+ class TBSCertificate(Sequence):
+ schema = (
+ ("version", Version(expl=tag_ctxc(0), default="v1")),
+ [...]
+
+ >>> tbs = TBSCertificate()
+ >>> tbs["version"] = Version("v2") # no need to explicitly add ``expl``
+
+ You can know if value exists/set in the sequence and take its value:
+
+ >>> "extnID" in ext, "extnValue" in ext, "critical" in ext
+ (True, True, False)
+ >>> ext["extnID"]
+ OBJECT IDENTIFIER 1.2.3
+
+ But pay attention that if value has default, then it won't be (not
+ in) in the sequence (because ``DEFAULT`` must not be encoded in
+ DER), but you can read its value:
+
+ >>> "critical" in ext, ext["critical"]
+ (False, BOOLEAN False)
+ >>> ext["critical"] = Boolean(True)
+ >>> "critical" in ext, ext["critical"]
+ (True, BOOLEAN True)
+
+ All defaulted values are always optional.
+
+ .. warning::
+
+ When decoded DER contains defaulted value inside, then
+ technically this is not valid DER encoding. But we allow
+ and pass it. Of course reencoding of that kind of DER will
+ result in different binary representation (validly without
+ defaulted value inside).
+
+ Two sequences are equal if they have equal specification (schema),
+ implicit/explicit tagging and the same values.
+ """