Skip to content

ustruct.unpack_from offset arg can't be a keyword #3918

@dhalbert

Description

@dhalbert

The documentation for ustruct.unpack_from(fmt, data, offset=0) shows the offset argument as being optional, with a default value: http://docs.micropython.org/en/latest/pyboard/library/ustruct.html?highlight=unpack_from#ustruct.unpack_from. This is the same as in CPython. But you can't name the arg:

MicroPython v1.9.4 on 2018-05-11; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> import ustruct
>>> ustruct.unpack_from('b', b'abc', offset=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function does not take keyword arguments

My impression is that, like other builtins that might take keyword args, you don't want to bother checking, for space reasons. So this should perhaps just be documented if the implementation of unpack_from is not going to change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions