René's URL Explorer Experiment


Title: () vs get_() vs _() · Issue #911 · googleapis/google-cloud-python · GitHub

Open Graph Title: () vs get_() vs _() · Issue #911 · googleapis/google-cloud-python

X Title: () vs get_() vs _() · Issue #911 · googleapis/google-cloud-python

Description: Moved over from #910 per @dhermes Goal of this issue is to decide: Is it reasonable to provide one-liners to do things like create_topic() which is just a wrapper: python def create_topic(self, name): topic = self.topic(name) topic.creat...

Open Graph Description: Moved over from #910 per @dhermes Goal of this issue is to decide: Is it reasonable to provide one-liners to do things like create_topic() which is just a wrapper: python def create_topic(self, nam...

X Description: Moved over from #910 per @dhermes Goal of this issue is to decide: Is it reasonable to provide one-liners to do things like create_topic() which is just a wrapper: python def create_topic(self, nam...

Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/911

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\u003cnoun\u003e() vs get_\u003cnoun\u003e() vs \u003cverb\u003e_\u003cnoun\u003e()","articleBody":"Moved over from #910 per @dhermes \n\nGoal of this issue is to decide:\n1. Is it reasonable to provide one-liners to do things like `create_topic()` which is just a wrapper:\n   `python\n   def create_topic(self, name):\n   topic = self.topic(name)\n   topic.create()\n   return topic\n   `\n2. Can we agree on the naming convention of what does and does not require an API request\n\n---\n\nComment from the pull request was...\n\n\u003e The name create_topic is ambiguous to new users. Does it mean create a Topic instance or actual insert one?\n\nThat's a good point. I think we should adopt the attitude that `client.\u003cverb\u003e_\u003cnoun\u003e()` is an API request. So `create_topic` would hit the API trying to 'insert' the topic (using Google's API lingo). `client.\u003cnoun\u003e` is nothing more than a factory for the noun which won't fire an API request but gives you back an instance of the \u003cnoun\u003e.\n\n\u003e We'd need to offer Client.topic and Client.create_topic side-by-side since users would need to construct pre-existing topics without sending insert.\n\nTotally agree -- I think we had this debate already and I'm totally sold on the need for `.topic()` as the sole way to get a hold of a topic object, without hitting the API (as the topic literally has _zero_ extra metadata).\n\nFor other APIs, where the object itself holds lots of (potentially important) metadata, I think it might be worthwhile to provide a `get_\u003cnoun\u003e()` to pull down that metadata, in addition to the `\u003cnoun\u003e()` method which just gives you an object which may not be tied to the remote (authoritative) representation.\n\nAn example here might be `bucket`.\n- `.bucket()` gives me a bucket object, sans remote data (no API request).\n- `create_bucket()` explicitly creates the bucket in the remote service, throwing an error if I was unable to do so.\n- `get_bucket()` would be an API request that gives me all the metadata about a bucket.\n\nNote that the `\u003cverb\u003e_bucket()` methods are really just shortcuts so that I can have one-liners for the common things I want to do with a bucket. (ie, `create` == `bucket = client.bucket('name'); bucket.create(); return bucket;`)\n\nIn boto for S3, they have this `verify` or `check` parameter on the bucket constructor, so the comparisons look like:\n\n| Action | boto | gcloud (suggestion) |\n| --- | --- | --- |\n| Get a bucket, no API request | `connection.get_bucket(validate=False)` | `client.bucket()` |\n| Get a bucket + metadata | `connection.get_bucket()` | `client.get_bucket()` |\n\nI personally don't love the boto method, and would much rather the \"gcloud (suggestion)\" option.\n","author":{"url":"https://github.com/jgeewax","@type":"Person","name":"jgeewax"},"datePublished":"2015-06-06T16:57:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":20},"url":"https://github.com/911/google-cloud-python/issues/911"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6545e6e7-6e6e-820f-208f-e0550b93717b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id92BC:1A1859:1100DA1:16B813C:6A4D8D9F
html-safe-nonced59f9d576b373858dd40a28870c28b85d2b18c7bda92e25dff78dbc41fe3094c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkJDOjFBMTg1OToxMTAwREExOjE2QjgxM0M6NkE0RDhEOUYiLCJ2aXNpdG9yX2lkIjoiNDEzNDg2NDU3NDk4NDU4ODcwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac48310f78009117b971a4e80017ebd10e1c4f303d3146e1475e312366e35d6a67
hovercard-subject-tagissue:85781210
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/911/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d336830bc3d23b5633c10d501a6b89aaadfab00ccc2511ae400cd268c194ba68/googleapis/google-cloud-python/issues/911
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d336830bc3d23b5633c10d501a6b89aaadfab00ccc2511ae400cd268c194ba68/googleapis/google-cloud-python/issues/911
og:image:altMoved over from #910 per @dhermes Goal of this issue is to decide: Is it reasonable to provide one-liners to do things like create_topic() which is just a wrapper: python def create_topic(self, nam...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejgeewax
hostnamegithub.com
expected-hostnamegithub.com
None9f8758a3953dfe943439713a6fa4f90d542a3431f10e861ca03dd7f39009f320
turbo-cache-controlno-preview
go-importgithub.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id16316451
octolytics-dimension-repository_nwogoogleapis/google-cloud-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id16316451
octolytics-dimension-repository_network_root_nwogoogleapis/google-cloud-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasebffd5484f01713a661b03469b77678f72b6574ed
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/google-cloud-python/issues/911#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F911
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F911
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=googleapis%2Fgoogle-cloud-python
Reloadhttps://github.com/googleapis/google-cloud-python/issues/911
Reloadhttps://github.com/googleapis/google-cloud-python/issues/911
Reloadhttps://github.com/googleapis/google-cloud-python/issues/911
Please reload this pagehttps://github.com/googleapis/google-cloud-python/issues/911
googleapis https://github.com/googleapis
google-cloud-pythonhttps://github.com/googleapis/google-cloud-python
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Fork 1.7k https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Star 5.3k https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Code https://github.com/googleapis/google-cloud-python
Issues 439 https://github.com/googleapis/google-cloud-python/issues
Pull requests 129 https://github.com/googleapis/google-cloud-python/pulls
Discussions https://github.com/googleapis/google-cloud-python/discussions
Actions https://github.com/googleapis/google-cloud-python/actions
Projects https://github.com/googleapis/google-cloud-python/projects
Security and quality 0 https://github.com/googleapis/google-cloud-python/security
Insights https://github.com/googleapis/google-cloud-python/pulse
Code https://github.com/googleapis/google-cloud-python
Issues https://github.com/googleapis/google-cloud-python/issues
Pull requests https://github.com/googleapis/google-cloud-python/pulls
Discussions https://github.com/googleapis/google-cloud-python/discussions
Actions https://github.com/googleapis/google-cloud-python/actions
Projects https://github.com/googleapis/google-cloud-python/projects
Security and quality https://github.com/googleapis/google-cloud-python/security
Insights https://github.com/googleapis/google-cloud-python/pulse
() vs get_() vs _()https://github.com/googleapis/google-cloud-python/issues/911#top
https://github.com/dhermes
api: corehttps://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22api%3A%20core%22
type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22type%3A%20feature%20request%22
https://github.com/jgeewax
jgeewaxhttps://github.com/jgeewax
on Jun 6, 2015https://github.com/googleapis/google-cloud-python/issues/911#issue-85781210
#910https://github.com/googleapis/google-cloud-python/pull/910
@dhermeshttps://github.com/dhermes
dhermeshttps://github.com/dhermes
api: corehttps://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22api%3A%20core%22
type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22type%3A%20feature%20request%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.