Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add positional args support for fdl.Config. #449

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jul 26, 2023

Add positional args support for fdl.Config.

config.posargs returns the *args list and can be accessed directly.

To access positional args:

v = config.posargs  # the full list
v = config.posargs[-1]  # normal index
v = config.posargs[:3]  # slice index

v = config[-1]  # normal index
v = config[:]  # slice index

To modify positional args:

config.posargs = [1, 2]  # assign to a new list, 
config.posargs = config.posargs.append(3) # append one item
config.posargs = config.posargs + [3] # append one item

config[0] = 0
config[:] = [1, 2, 3]

@copybara-service copybara-service bot changed the title Add positional args support for fdl.Config Add positional args support for fdl.Config. Aug 18, 2023
`config.posargs` returns the *args list and can be accessed directly.

To access positional args:
```python
v = config.posargs  # the full list
v = config.posargs[-1]  # normal index
v = config.posargs[:3]  # slice index

v = config[-1]  # normal index
v = config[:]  # slice index
```

To modify positional args:

```python
config.posargs = [1, 2]  # assign to a new list,
config.posargs = config.posargs.append(3) # append one item
config.posargs = config.posargs + [3] # append one item

config[0] = 0
config[:] = [1, 2, 3]
```

PiperOrigin-RevId: 549731020
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.

1 participant