Skip to content

Conversation

@tekknolagi
Copy link
Contributor

_asdict is not public API for namedtuple.

You may want to consider using the built-in string module, which
implements this kind of .0/.foo formatting.

`_asdict` is not public API for `namedtuple`.

You may want to consider using the built-in `string` module, which
implements this kind of `.0`/`.foo` formatting.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 99.184% when pulling c450567 on tekknolagi:main into 4bc5648 on noahmorrison:main.

@noahmorrison noahmorrison merged commit 6959ae7 into noahmorrison:main Jan 2, 2021
@tekknolagi
Copy link
Contributor Author

Oops, I forgot a test for changing behavior in this commit and you merged faster than I could amend my commit D: I'll file a subsequent PR.

tekknolagi added a commit to tekknolagi/chevron that referenced this pull request Jan 2, 2021
@noahmorrison
Copy link
Owner

Ahh, thanks for catching that. That's obviously a much better way to handle it.

I'm not sure I understand your point about the string module?

@tekknolagi
Copy link
Contributor Author

Kind of like this:

import string

class C:
    foo = "bar"

f = string.Formatter()
instance = C()
result = f.format("{0.foo}", instance)
assert result == "bar"

There's get_field and get_value, etc: https://docs.python.org/3.7/library/string.html#string.Formatter

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