Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simple rule #26

Answered by amogorkon
renemkr asked this question in Q&A
Apr 22, 2022 · 1 comments · 1 reply
Discussion options

I'm triying to make a simple rule IF A then B
but if I write
R1 = Rule({A: B})
R1 = Rule({temp.hot: motor.fast})

Gives me an error
TypeError: 'Set' object is not iterable

You must be logged in to vote

Hi, did you figure it out?

Rules are there to map sets of one domain to a single set of another, so it expects the left side to be an iterable like a tuple.

Try

R1 = Rule({(temp.hot, ): motor.fast})

That should do the trick.

Replies: 1 comment 1 reply

Comment options

Hi, did you figure it out?

Rules are there to map sets of one domain to a single set of another, so it expects the left side to be an iterable like a tuple.

Try

R1 = Rule({(temp.hot, ): motor.fast})

That should do the trick.

You must be logged in to vote
1 reply
Comment options

I thought it was a simple thing, but my Python is a bit basic at the moment. Thank you very much!!

Answer selected by amogorkon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /