Skip to content

Fix ClassSelector.get_range() for class_ tuple - #360

Merged
ceball merged 2 commits into
masterfrom
class_selector_tuple
Nov 28, 2019
Merged

ceball merged 2 commits into
masterfrom
class_selector_tuple

Conversation

@philippjfr

Copy link
Copy Markdown
Member

ClassSelector allowed using class_=some_tuple but ClassSelector.get_range() would error in that case.

@philippjfr
philippjfr requested a review from jbednar November 7, 2019 17:51
@ceball

ceball commented Nov 7, 2019

Copy link
Copy Markdown
Contributor

Looks correct to me.

I've tried to propose a better first line of the docstring - maybe someone can do better?

Current:

    """
    Parameter whose value is a specified class or an instance of that class.
    By default, requires an instance, but if is_instance=False, accepts a class instead.
    Both class and instance values respect the instantiate slot, though it matters only
    for is_instance=True.
    """

Proposed:

    """
    Parameter whose value is - or is an instance of - class_, where class_ is a single class or tuple of classes.
    By default, requires an instance, but if is_instance=False, accepts a class instead.
    Both class and instance values respect the instantiate slot, though it matters only
    for is_instance=True.
    """

Starting again maybe the class slot would be called something like classinfo instead (like isinstance()'s classinfo parameter).

@jbednar jbednar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For the first line of the docstring, maybe "Parameter allowing selection of either a subclass or an instance of a given set of classes".

Comment thread param/__init__.py Resolved
@ceball
ceball merged commit fbbe2d9 into master Nov 28, 2019
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.

3 participants