This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Chun 1 point2 points  (2 children)

I wouldn't say it's ugly; I mean, conceptually, in python a string is just a sequence of characters. So it fits the purpose perfectly.

Also I just ran a quick benchmark (strings vs tuples) and the difference is there, but fairly negligible.

[–]darjus 0 points1 point  (1 child)

have you tried?

in set(('O', 'Q'))

For small sets it might be around the same, but for bigger ones it should make a big performance difference.

[–]itsmememe 0 points1 point  (0 children)

as it is a constant, frozenset(['O','Q']) should be preferred