Skip to content

Conversation

@msullivan
Copy link
Member

We support dicts (and other mappings), and for named tuples we do
lookup by name instead of by position.

Fixes #374.

@msullivan msullivan requested review from 1st1 and fantix January 31, 2024 22:19
We support dicts (and other mappings), and for named tuples we do
lookup by name instead of by position.

Fixes #374.
item = obj[name]
elif is_namedtuple:
name = datatypes.record_desc_pointer_name(self.descriptor, i)
item = getattr(obj, name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth wrapping possible AttributeError/KeyError to make it nicer.

@msullivan msullivan merged commit ca40114 into master Feb 2, 2024
@msullivan msullivan deleted the namedtuple branch February 2, 2024 22:57
@msullivan
Copy link
Member Author

@raddevon We'll probably want some docs about this once we've got a version update out

aljazerzen pushed a commit that referenced this pull request Feb 15, 2024
We support dicts (and other mappings), and for named tuples we do
lookup by name instead of by position.

Fixes #374.
This was referenced Feb 23, 2024
aljazerzen added a commit that referenced this pull request Feb 24, 2024
Fixes
=====

* Fix globals in nested modules (#474)
  (by @msullivan in ff08d9d for #474)

* Support passing dicts and namedtuples for namedtuple arguments (#473)
  (by @msullivan in 60da99a for #374)

* Expose the error details field. (#479)
  (by @vpetrovykh in 113ed0d for #472)
aljazerzen added a commit that referenced this pull request Feb 26, 2024
Fixes
=====

* Fix globals in nested modules (#474)
  (by @msullivan in ff08d9d for #474)

* Support passing dicts and namedtuples for namedtuple arguments (#473)
  (by @msullivan in 60da99a for #374)

* Expose the error details field. (#479)
  (by @vpetrovykh in 113ed0d for #472)
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.

Support way to specify named tuples using names

3 participants