Skip to content

Pipelines seem to be false-y #994

Closed
Closed
@anderson-dan-w

Description

@anderson-dan-w

This is a non-blocking issue, since there's a clear work-around, but I just found it surprising:

r = redis.Redis()
pipe = r.pipeline()
pipe  ## Pipeline<ConnectionPool<Connection<host=127.0.0.1,port=6379,db=0>>>
pipe or True  ## True

## workaround:
pipe if pipe is not None else True

Is there a particular reason pipeline objects should appear false-y? My inclination is that this doesn't pass the Principle of Least Surprise (but maybe I'm missing something).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions