majek / puka

Puka - the opinionated RabbitMQ client
https://github.com/majek/puka
Other
182 stars 34 forks source link

unify struct.pack params #54

Open majek opened 10 years ago

majek commented 10 years ago
~/puka/puka$ grep "pack(" *py|sed "s|.*pack(\(.*\)\$|\1|g"|cut -d "," -f 1|sort| uniq -c
     32 '!B'
      1 'B'
      1 '!BBBB'
      1 '!BHI'
      2 '>c'
      1 '>cB'
      2 '>cBi'
      1 '>cd'
      1 '>ci'
      2 '>cI'
      1 '>cq'
      1 '>cQ'
      2 '!HH'
      1 '!HHQH'
      1 '>I'
      4 '!I'
      8 '!IB'
     14 '!IHB'
      1 '!IHIH'
      1 '!II'
      1 '!IIHB'
      3 '!IQB'
      1 '!Q'
~/puka/puka$ grep "unpack_from(" *py|sed "s|.*unpack_from(\(.*\)\$|\1|g"|cut -d "," -f 1|sort| uniq -c
      2 '>B'
     26 '!B'
      2 'B'
      1 '!BB'
      1 '!BHI'
      1 '>d'
      1 '>f'
      1 '>h'
      1 '!H'
      3 '!HB'
      2 '!HH'
      1 '!HIH'
      1 '!HxxQ'
      2 '>i'
      3 '>I'
      8 '!I'
      1 '!II'
      1 '>q'
      1 '>Q'
      1 '!Q'
      1 '!QB'
      2 '!QBB'

We could kill '!' for 'B', not use '>', and maybe use ord instead of B. Or even proper pack constructructors for more complex things.