GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DISCUSSION: Are setter methods which clone and return object type confusing to end-users? · Issue #188 · googleapis/google-cloud-python

DISCUSSION: Are setter methods which clone and return object type confusing to end-users? #188

New issue
Copy link
New issue
Copy link
Closed
Closed
DISCUSSION: Are setter methods which clone and return object type confusing to end-users?#188
Copy link
Assignees
dhermes
Labels
type: questionRequest for information or clarification. Not an issue.

Description

@dhermes
dhermes
opened on Sep 25, 2014
Issue body actions

Methods like datastore.key.Key.dataset act as both setters and getters and return a different type of object depending on whether they set or get.

In this case key.dataset(dataset=NEW_DATASET) returns a new clone Key object (to keep the instances immutable, as @tseaver pointed out was discussed in #3) where key.dataset() simply returns a datastore.dataset.Dataset object.

For me (@dhermes) it's really a method which is somewhat overloaded in it's scope (though I'll acknowledge the code is typically short).

I'd be much more in favor of two separate methods for getting and setting, i.e.
update_dataset as a method and dataset decorated with @property as a getter only.

curr_dataset = key.dataset  # Actually a getter.
new_key = key.update_dataset(dataset=NEW_DATASET)

Activity

Next
  1. silvolu commented on Sep 30, 2014

    @silvolu
    silvolu
    on Sep 30, 2014
    Contributor
    More actions

    I like your proposal, I think it's a small price to pay for a more clear API. @aliafshar, any thoughts on this one?

  2. dhermes
    added
    type: questionRequest for information or clarification. Not an issue.
    on Oct 3, 2014
  3. dhermes commented on Dec 30, 2014

    @dhermes
    dhermes
    on Dec 30, 2014
    ContributorAuthor
    More actions

    Closing out due to discussion in Datastore Package API Surface Discussion.

    After implemented, this will only occur on datastore.Query and with an expanded constructor even that won't be necessary. (Also, #439 will help a bit.)

  4. dhermes
    closed this as completedon Dec 30, 2014
  5. jgeewax
    modified the milestone: This milestone has been deleted on Jan 30, 2015
  6. urshala
    added a commit that references this issue on Jan 17, 2020

    Fix googleapis#188

    This issue will close once commit 45d1269 is merged into the 'master' branch.
    45d1269
  7. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  8. atulep
    added 3 commits that reference this issue on Apr 3, 2023

    chore(python): simplify nox steps in CONTRIBUTING.rst (#188)

    2bf2df1

    chore(python): simplify nox steps in CONTRIBUTING.rst (#188)

    25bb5f2

    chore(python): simplify nox steps in CONTRIBUTING.rst (#188)

    7b3a4e5
  9. atulep
    added a commit that references this issue on Apr 18, 2023

    chore(python): simplify nox steps in CONTRIBUTING.rst (#188)

    82612c7
  10. vchudnov-g
    added 2 commits that reference this issue on May 8, 2023

    chore(main): release 1.4.0 (#188)

    3d06c53

    chore(migration): Migrate code from googleapis/python-domains into pa…

    9d913ad
  11. parthea
    added a commit that references this issue on May 31, 2023

    chore(python): update .kokoro/requirements.txt (#188)

    91d7d9b
  12. 60 remaining items

  13. parthea
    added 9 commits that reference this issue on Nov 24, 2025

    fix: drop python 3.6 (#188)

    f831d73

    chore: new owl bot post processor docker image (#188)

    8d0a0b7

    chore(deps): update all dependencies (#188)

    33f9216

    chore(deps): update dependency pytest to v7.3.2 (#188)

    1d2b27b

    build(deps): bump cryptography from 38.0.3 to 39.0.1 in /synthtool/gc…

    0f187bb

    chore(deps): update all dependencies (#188)

    025cf69

    chore: release 1.3.0 (#188)

    21d4297

    Merge pull request #188 from googleapis/beta-launch

    170432e

    Add error message to handle case of empty string or missing file for …

    052da41
  14. parthea
    added a commit that references this issue on Mar 2, 2026

    chore(deps): update dependency setuptools to v69.0.2 (#188)

    bdae79d
  15. parthea
    added 4 commits that reference this issue on Mar 9, 2026

    fix: connection reset fails when an additional dialect is used (#188)

    6d0f7b9

    feat: adding missing docstrings for functions & classes (#188)

    70c4ff5

    chore: release 3.0.0 (#208)

    23fc439

    chore(main): release 1.4.4 (#188)

    7c5cf3a
  16. ohmayr
    added a commit that references this issue on Mar 31, 2026

    chore(deps): update dependency setuptools to v69.0.2 (#188)

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

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.