What exactly does "*values" mean in the following code? Is this a
pointer to a PyList? Why can I not find good documentation on this any
where? I must be blind:
[color=blue][color=green][color=darkred]
>>> from struct import *
>>> format = "dl"
>>> values = [3.14, 42]
>>> foo = pack(format, *values)
>>> foo[/color][/color][/color]
'\x1f\x85\xebQ\ xb8\x1e\t@*\x00 \x00\x00'[color=blue][color=green][color=darkred]
>>> unpack(format, foo)[/color][/color][/color]
(3.140000000000 0001, 42)[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
More importantly still, how would you write the same code in C? If you
wanted to instead call struct_pack(PyO bject *tuple), what would the
tuple look like in C?
Thanks to anyone who can clear all this up for me.
Greg
pointer to a PyList? Why can I not find good documentation on this any
where? I must be blind:
[color=blue][color=green][color=darkred]
>>> from struct import *
>>> format = "dl"
>>> values = [3.14, 42]
>>> foo = pack(format, *values)
>>> foo[/color][/color][/color]
'\x1f\x85\xebQ\ xb8\x1e\t@*\x00 \x00\x00'[color=blue][color=green][color=darkred]
>>> unpack(format, foo)[/color][/color][/color]
(3.140000000000 0001, 42)[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
More importantly still, how would you write the same code in C? If you
wanted to instead call struct_pack(PyO bject *tuple), what would the
tuple look like in C?
Thanks to anyone who can clear all this up for me.
Greg
Comment