scapy - Angle brackets in Python -
this question has answer here:
i want craft packets using scapy. when looking through ip() class members came across following code idiom:
'fieldtype': { 'frag': <field (ip,iperror).frag>, 'src': <field (ip,iperror).src>, 'proto': <field (ip,iperror).proto>, 'tos': <field (ip,iperror).tos>, 'dst': <field (ip,iperror).dst>, 'chksum': <field (ip,iperror).chksum>, 'len': <field (ip,iperror).len>, 'options': <field (ip,iperror).options>, 'version': <field (ip,iperror).version>, 'flags': <field (ip,iperror).flags>, 'ihl': <field (ip,iperror).ihl>, 'ttl': <field (ip,iperror).ttl>, 'id': <field (ip,iperror).id>}, 'time': 1465637588.477862, 'initialized': 1, 'overloaded_fields': {},
i relatively new python. can explain me purpose angle brackets serve in each field type definition?
i have been trying figure out myself using following documentation got stuck.
thanks
repr
when applied field
instance uses following definition __repr__
source of not python syntax.
def __repr__(self): return "<field (%s).%s>" % (",".join(x.__name__ x in self.owners),self.name)
Comments
Post a Comment