Skip to content

Fixed example code - #225

Closed
dividuum wants to merge 1 commit into
apple:masterfrom
dividuum:master
Closed

Fixed example code#225
dividuum wants to merge 1 commit into
apple:masterfrom
dividuum:master

Conversation

@dividuum

Copy link
Copy Markdown

Python code works and matches the documentation.

Now the Python code works and matches the documentation.
@dividuum dividuum mentioned this pull request Apr 22, 2018
@alecgrieser

Copy link
Copy Markdown
Contributor

Looking at your comment in #217, yeah, I think that that is the right way to go. (It would at least make Java and Python consistent). You could also (instead of collecting the iterator as a list) use a for-else construct or whatever the most pythonic way to grab the first item from an iterator is (I'm not sure).

@dividuum

Copy link
Copy Markdown
Author

Right. I played a bit more with foundationdb and the following also works as an empty range just falls through and returns None.

@fdb.transactional
def get_user(tr, ID):
    for key, value in tr.get_range_startswith(user[ID], limit=1):
        return value

@alecgrieser

Copy link
Copy Markdown
Contributor

Hm, I think I'd prefer if it explicitly returned None on the failure case (even though it doesn't have to, strictly speaking), but other that, looks good.

@alexmiller-apple

Copy link
Copy Markdown
Contributor

@dividuum, any chance you have some time to address the review feedback so that we can merge the PR? 🙂

@alexmiller-apple

Copy link
Copy Markdown
Contributor

Hi @dividuum,

We're wrapping up the work that was slated for the 6.1 release, and will start looking to cut the release branch. Any chance you'd have the time to revisit this PR? If this were to be merged in the next week or two, then it would be included in the 6.1 release. Otherwise, it'd likely be ~6mo until the next release.

Thanks,
Alex

ajbeamon added a commit to ajbeamon/foundationdb that referenced this pull request Mar 1, 2019
@ajbeamon

ajbeamon commented Mar 2, 2019

Copy link
Copy Markdown
Contributor

Resolved in #1218

@ajbeamon ajbeamon closed this Mar 2, 2019
etschannen added a commit to etschannen/foundationdb that referenced this pull request Mar 26, 2019
sfc-gh-tclinkenbeard added a commit to sfc-gh-tclinkenbeard/foundationdb that referenced this pull request May 29, 2023
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.

4 participants