pybind11 icon indicating copy to clipboard operation
pybind11 copied to clipboard

pytypes: Add iterable_t<T>

Open EricCousineau-TRI opened this issue 3 years ago • 7 comments

Description

Resolves #1773 as an alternative / less disruptive approach Drawing from https://github.com/robotlocomotion/drake/pull/14898

Suggested changelog entry:

iterable_t<T> added as a simple pytype

EricCousineau-TRI avatar Apr 14 '21 11:04 EricCousineau-TRI

Just commenting to say I'm working on something atm for which this would be useful :-)

alexdewar avatar Apr 06 '22 16:04 alexdewar

Just commenting to say I'm working on something atm for which this would be useful :-)

This needs to be resurrected after the sweeping changes for clang-format and Python 2 drop. You could transfer the diffs to a new PR and work on it there.

rwgk avatar Apr 06 '22 17:04 rwgk

This needs to be resurrected after the sweeping changes for clang-format and Python 2 drop. You could transfer the diffs to a new PR and work on it there.

It was luckily small enough w/ just a merge + conflict resolution. I think the review is still fine w/ merge. Let me know if you'd still like a new PR.

EricCousineau-TRI avatar Apr 11 '22 00:04 EricCousineau-TRI

is_generic_type split off into #3857

EricCousineau-TRI avatar Apr 11 '22 00:04 EricCousineau-TRI

Aye - so you think it's best to not introduce the feature? Fine by me, just want to clarify some points.

The code seems to be dicy ("bad! For now,") and the gain seems really minute ("slightly too restrictive").

Too restrictive in what sense? Not an iterator, or shouldn't check types, or something else?

EricCousineau-TRI avatar Apr 11 '22 23:04 EricCousineau-TRI

Aye - so you think it's best to not introduce the feature? Fine by me, just want to clarify some points.

The code seems to be dicy ("bad! For now,") and the gain seems really minute ("slightly too restrictive").

Too restrictive in what sense? Not an iterator, or shouldn't check types, or something else?

Sorry I wasn't clear, the "slightly too restrictive" quote is from here: https://github.com/pybind/pybind11/issues/1773

I.e. my interpretation was that even the original requester was thinking the current behavior is only "slightly too restrictive". (I agree.)

My cost/benefit assessment is just one vote! Yes, I'd say let's not add this, but if there are other opinions I'll reconsider. I'm just offering my current opinion.

rwgk avatar Apr 11 '22 23:04 rwgk

Sounds good! I'm not too wed to this, but will await opinions, and close if we don't hear back for a bit (~month?)

@alexdewar If you're available, is this still useful as-is?

EricCousineau-TRI avatar Apr 11 '22 23:04 EricCousineau-TRI