NewLionwang / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

one parameter format #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
class P(dpkt.Packet):
   __hdr__ = (('a','B',0))
won't work

class P(dpkt.Packet):
   __hdr__ = [('a','B',0)]

works.

Original issue reported on code.google.com by sunyi...@gmail.com on 15 Mar 2007 at 9:59

GoogleCodeExporter commented 8 years ago
this is actually a Python language issue not specific to dpkt.

what you want is

   __hdr__ = (('a','B',0), )    # note the dangling comma

from http://docs.python.org/lib/typesseq.html:

"A single item tuple must have a trailing comma, such as (d,)."

using a list instead is fine too, and probably looks better anyway. :-)

Original comment by dugsong on 16 Mar 2007 at 12:02