Skip to content

Conversation

@Chipe1
Copy link
Contributor

@Chipe1 Chipe1 commented Aug 25, 2017

Based on the comments in #625

return {x}
else:
return {symbol for arg in x.args for symbol in prop_symbols(arg)}
return set().union(*map(prop_symbols, x.args))
Copy link
Collaborator

Choose a reason for hiding this comment

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

To be honest, I prefer the comprehension to the set union with the map pointer, since it is much easier to understand (at least for me).

If both are correct, I would change it to the comprehension (which is simpler and stylistically closer to the way we do things in the repository).

That is unless the union is much, much faster or is the most popular way to deal with the problem.

Copy link
Contributor Author

@Chipe1 Chipe1 Aug 25, 2017

Choose a reason for hiding this comment

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

The map method is efficient but I dont think we need to worry about speed as we are using only small expressions. Since it is not directly mentioned in any pseudocode, people could think of it as a simple blackbox function and not really care to look into it. Finally, it's upto @norvig
Maybe we can use both. One in each of the functions :D

return {x}
else:
return {symbol for arg in x.args for symbol in constant_symbols(arg)}
return set().union(*map(constant_symbols, x.args))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as my above review.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you think the comprehension is easier to understand, let's stick with that.

@norvig norvig closed this Aug 25, 2017
@Chipe1 Chipe1 deleted the suggfoil branch August 25, 2017 16:26
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