Skip to content

Conversation

@elprans
Copy link
Member

@elprans elprans commented Mar 24, 2017

Fixes: #93.

@elprans elprans requested a review from 1st1 March 24, 2017 14:15
@elprans elprans self-assigned this Mar 24, 2017
Copy link
Member

@1st1 1st1 left a comment

Choose a reason for hiding this comment

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

So can this new exposed Record type be constructed from pure Python? What will happen if you try to? Do we need to expose RecordDesc type too?

@elprans
Copy link
Member Author

elprans commented Mar 24, 2017

Currently, Record cannot be instantiated directly, as it has no tp_new and tp_init. If we decide to allow creating Record instances, I think we should simply take an iterable of (key, value) tuples.

@elprans elprans force-pushed the export-record-type branch 2 times, most recently from afd10fb to df833f9 Compare March 24, 2017 15:28
are similar to instances of ``collections.namedtuple`` and allow addressing
of values either by a numeric index or by a field name:
is represented by an instance of the :class:`~asyncpg.Record` object.
``Record`` objects are similar to instances of ``collections.namedtuple`` and
Copy link
Member

Choose a reason for hiding this comment

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

Records are actually closer to dicts. They use __getitem__, have .items(), .values() and .keys() methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@elprans elprans force-pushed the export-record-type branch from df833f9 to 671ff4a Compare March 24, 2017 15:46
@elprans elprans force-pushed the export-record-type branch from 671ff4a to 5940b46 Compare March 24, 2017 15:59
Copy link
Member

@1st1 1st1 left a comment

Choose a reason for hiding this comment

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

LGTM

@elprans elprans merged commit d42608f into master Mar 24, 2017
@elprans elprans deleted the export-record-type branch March 24, 2017 16:37
@jamesstidard
Copy link

@elprans Thanks for taking the time to add this, appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants