Skip to content

Tuple variables#89

Merged
da-h merged 2 commits intomasterfrom
tuple_arguments
Nov 11, 2021
Merged

Tuple variables#89
da-h merged 2 commits intomasterfrom
tuple_arguments

Conversation

@da-h
Copy link
Copy Markdown
Owner

@da-h da-h commented Nov 11, 2021

Tuple variables

This MR extends the use of lists to tuples (fixed-size lists).

Description

  • The default behavior is that miniflask (as for lists) assumes that all elements have the same type.
  • It then checks for the first argument type of the tuple and uses its length to specify the number of arguments needed in case the CLI overwrites the variable.
  • Using the wrong number of arguments exits the code with an error

Things done in this MR

  • enabled tuples

Check all before creating this PR:

  • Documentation adapted
  • unit tests adapted / created

Example Usage

def register(mf):
    mf.register_defaults({'tuple_variable', (42,43,44))

@da-h da-h linked an issue Nov 11, 2021 that may be closed by this pull request
@da-h da-h added this to the v2.1 milestone Nov 11, 2021
@da-h da-h merged commit d2c40e0 into master Nov 11, 2021
github-actions Bot pushed a commit that referenced this pull request Nov 11, 2021
@da-h da-h deleted the tuple_arguments branch November 11, 2021 17:09
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.

Implement also tuples as arguments

1 participant