Skip to content

Conversation

pacew
Copy link

@pacew pacew commented Nov 29, 2019

Delete stray "*" in documentation of arguments for making a TileGrid

@jepler
Copy link

jepler commented Nov 29, 2019

Hi. Thanks for helping make CircuitPython better! In this case, though, I think the documentation is correct even though it looks unusual.

Here's how the C code defines the way that TileGrid's constructor needs to be used:

    static const mp_arg_t allowed_args[] = {
        { MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ },
        { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
        { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} },

Notice that the line for pixel_shader is KW_ONLY and REQUIRED.

A "*", followed by an argument without a default value, is the same way you define such an argument in CPython3:

>>> def f(x, *, y, z=0): pass
>>> f(1)
TypeError: f() missing 1 required keyword-only argument: 'y'

Let me know if I overlooked something and thanks again!

@tannewt tannewt closed this Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants